String From List ignoring "Enter"

Using @Konrad_K_Sobon String From List node (with a little modification), I am trying to join strings with a “|” separator. Single lines work fine, but I also need to have multiple lines with an “Enter” after each line.
Problem is that when joining the strings “Enter” causes it to insert another separator. Is there any other method besides newString.append(Seperator.join(i)) that would prevent this?


#Copyright(c) 2015, Konrad Sobon
# @arch_laboratory,

import clr
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
Seperator = IN[1]

newString = []
for i in IN[0]:
#Assign your output to the OUT variable
OUT = newString

I would probably use List.Chop to make sure your sublists have groups of three values. Then you can be sure that everything gets joined correctly and you’ll still keep your list structure.

Found it, It was actually a simple solution. Using String.Replace, find the string sequence of " ’ Enter |" and replace it with " ’ Enter"


I don’t see any issue here. The separator is added after every list member. In this case the list item is 10’ Enter so it adds the | after it and then 299 | RTF…

If list was 1, 2, 3 then it would do 1 | 2 | 3.

@Konrad_K_Sobon Your node works completely as intended. I was looking for a different handling of “Enter”. I was able to get rid of an extra | after going through your node with string.replace so that my output for list 6 looks like this:
299|RPF-12 #3|5’
299|RPF-12 #3|10’
299|RPF-12 #3|15’

Thank you for the great work you do!