Page 1 of 1

add tab before each string

Posted: Wed Mar 11, 2020 8:31 am
by GLIC
Hello.
Here I am stuck again. How can I add tab before each line string?

Example:
data1
data2
data3
...


becomes:
tab data1
tab data1
tab data1
...


Thank you

Re: add tab before each string

Posted: Wed Mar 11, 2020 10:47 am
by kortezzzz
Hi,
It has been discussed yesterday. Use the Ruby editor (1 string array input, 1 string array output) and add this code:

Code: Select all

output @ins[0].map { |item| "tab " << item }


Then every array index gonna get the "tab" prefix.

Re: add tab before each string

Posted: Wed Mar 11, 2020 11:21 am
by GLIC
Thank you, but it does not work.
It`s easy for programmer to say use Ruby. Using such horrible and difficult to learn language as Ruby defeats point of using FLowStone. Not everyone has same type of thinking and can do typical coding. For people like me visual programming is almost only way we can build something. Plus I just do not see a decent way to learn Ruby in FlowStone environment, because syntax does not match fully.
Is there any websites for learning this effectively?

Re: add tab before each string

Posted: Wed Mar 11, 2020 11:27 am
by GLIC
undefined method `map' for "":String

Re: add tab before each string

Posted: Wed Mar 11, 2020 3:28 pm
by kortezzzz
Believe it or not, in coding, I'm worse then you by any mean, but this piece of code posted yesterday by our forum member tulamide and it works as is by just coy\pasting. But attached an example schematic for downloading just to make sure you got it.