counting strings on array

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

counting strings on array

Post by tester »

If I have a string array (with long textual strings; thus - ruby), I'd like to count - how many lines are not empty. Like this:

---------
text
text

text


text

---------

In general - there are 8 lines on that array, but not empty - only four. How to detect them? I guess it should be some simple formula for empty lines removal, and then measurement via int primitive connected to array out. Or...?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: counting strings on array

Post by chackl »

Not a Primitive but you could do that in ruby very simple ;)

Regards
Attachments
count array.fsm
(462 Bytes) Downloaded 856 times
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: counting strings on array

Post by tester »

Thanks.

Actually, some things I'm doing right now - require ruby instead of regular green prims, because ruby deals on the fly with arrays, while green prim based solutions are veeeery sluggish. Though - there are still things, that I prefer to rely on green wiring. I guess it's a matter of precising (in FS environment) - which things should be done with ruby, and which should not (the rest of the party can be done with it, but does not have to). And I guess for most folks there is no difference anyway. ;-)

I guess Trog is very happy, that I started to use ruby. :mrgreen: :ugeek:
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply