add tab before each string

For general discussion related FlowStone
Post Reply
GLIC
Posts: 11
Joined: Tue Sep 11, 2018 3:00 pm

add tab before each string

Post 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
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: add tab before each string

Post 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.
GLIC
Posts: 11
Joined: Tue Sep 11, 2018 3:00 pm

Re: add tab before each string

Post 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?
GLIC
Posts: 11
Joined: Tue Sep 11, 2018 3:00 pm

Re: add tab before each string

Post by GLIC »

undefined method `map' for "":String
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: add tab before each string

Post 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.
Attachments
(ADD STRING TO STRING ARRAY INDEXES).fsm
Made with 3.0.6 version
(350 Bytes) Downloaded 880 times
Post Reply