Page 1 of 1

counting strings on array

Posted: Mon Oct 28, 2013 1:20 am
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...?

Re: counting strings on array

Posted: Mon Oct 28, 2013 8:09 am
by chackl
Not a Primitive but you could do that in ruby very simple ;)

Regards

Re: counting strings on array

Posted: Mon Oct 28, 2013 12:33 pm
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: