Parser to yield index of position in comma delim string list
Archive · 200610 old posts
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
oddson ·
Can anyone good at the parser components give me a module that would return an index integer to where in a list of comma delimited items a given text match was found?
Inputs
1) comma delimited string of items
2) comparison string
Output
1) index integer of found position
2) boolean success indicator
alternately 0 = not found and a non-zero position indicator
oddson ·
Forgot to say PLEASE! 🙂 😇
I might be able to do this myself but it will take 10 times as long... I need it to fix the TableSynth!
I don't care if it's the parser but I'd like to avoid any loop solutions as the last thing TableSynth needs is something slowing down wave loads.
dasdeck ·
? 😉 (sounds like the findstring component to me)
D3CK
oddson ·
That finds the character position in a string. I need the item number in a comma delimited list. (Does anyone remember HyperCard?)
dasdeck ·
of cousrse, sorry, forgive me........ I'll build sometihn for you now. 😉
is this what you want? the connectors are a bit different to waht you want, they follow my own standart.
😉
D3CK
oddson ·
Great... thank you... if it's not exactly what I need I can certainly make it work. I'm just a little weak with the parser components.
Thanks again. 🙂
rl ·
not tried yet, but I could think about another way: use the "normal" string components, search for the ',' - delimiter, split into left and right string, if found: increase counter by 1 and feed the right-hand string (the rest) back into the schematic (using a StringSwitch) thus basically using recursion.
dasdeck ·
what would be more efficient?
i would think the parser is very efficient, but how is it?
can you tell please?
😇
D3CK
oddson ·
Your solution worked well enough for what I was trying... unfortunately the underlying method I was using didn't work quickly enough (it involved a large number of wireless connectors to move table data around).
I can't see how rl's would work without the loop component and, in general, looped behaviour can be slow. If you were extracting an item from a list for a user interface issue once in a while either would be fine. I assume yours would be quicker for something called many hundreds of times as it was in the thing I was trying -- but I never tried to build rl's alternative.
Your help is greatly appreciated as without it I would not know I was going up a blind alley... even though it's not going to be in the finished product it helped.
Thanks again.
Wrote something here? To have a post removed or your name hidden, write to [email protected].