Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

add tab before each string

For general discussion related FlowStone

add tab before each string

Postby GLIC » Wed Mar 11, 2020 8:31 am

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

Re: add tab before each string

Postby kortezzzz » Wed Mar 11, 2020 10:47 am

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

Re: add tab before each string

Postby GLIC » Wed Mar 11, 2020 11:21 am

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

Postby GLIC » Wed Mar 11, 2020 11:27 am

undefined method `map' for "":String
GLIC
 
Posts: 11
Joined: Tue Sep 11, 2018 3:00 pm

Re: add tab before each string

Postby kortezzzz » Wed Mar 11, 2020 3:28 pm

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


Return to General

Who is online

Users browsing this forum: No registered users and 88 guests