Page 1 of 1

Array output to vertical list

Posted: 30 Aug 2016, 13:00
by joysprod
Hi, Appreciate any help on this. I have an array of names and I want to show them as a vertical list. i.e.

Name 1, Name 2, Name 3, Name 4, Name x as the output from my array, but I would like to easily show as a single text...

Name 1
Name 2
Name 3
Name 4
Name x

I have tried to use a String Replace node on the occurrence of every comma but cant find how to put in a carriage return instead ( If that would in fact work)

Regards

Peter

Re: Array output to vertical list

Posted: 30 Aug 2016, 14:54
by lerou
try putting your string array into a string expression. Use the following as the expression:
A.Replace(", ", "\n")

A string array is converted to a string as "One, Two, Three". Note the spaces. Now we replace the comma-space ", " by a line break. Not the cleanes solition but it should work.

cheers,
rou

Re: Array output to vertical list

Posted: 30 Aug 2016, 16:34
by joysprod
Brilliant!

Thanks Rou.

Re: Array output to vertical list

Posted: 30 Aug 2016, 16:48
by stephen
Hey Peter, Rou,

just a side note:
You do not necessarily need to use an Expression Node. You can also still use the String Replace Node. Just type the New Line in the Text Editor instead of the Property Editor by clicking on the three dots in the Replace Property. Here you can insert line breaks by simply hitting the Return Key on your keyboard. So it is not really a problem of the Replace Node, but the Property Editor.

The Property Editor is only able to edit one-line strings - therefore you cannot insert a new line in here. The Text Editor can, though. :D
TextEditorNewLine.png
Stephen