Check String - Javascript?

Subtiv's picture

Hi all,

is there anyone who can point me in the right direction with a javascript patch? (it might be possible through another method, but i'm pretty sure Java can do the job)

What i try to achieve is a javascript patch who takes as input a string which has been separated to a structure. I need the javascript patch to check if any of the inputs matches with some predefined strings.

For example: if the input is 2 1 5 7 8 0 and it's been transformed to a structure with the comma as separator, then i want the javascipt to have 10 outputs with output "1" = true, "2" = true, "3" = false, ..., "0" = true. So the output has to be a series of booleans.

Thanks for any help!

idlefon's picture
Re: Check String - Javascript?

I made you an example patch:

1- The java script patch output a structure of 1(true) and 0(false). 2- The "checkend" parameter checks the input string with the range (0-checkend).

See if it's what you want or do you need any modifications?

PreviewAttachmentSize
String check.qtz2.59 KB

Subtiv's picture
Re: Check String - Javascript?

Allright,

this is great, the only problem is that it doesn't check a number above "10", maybe because he thinks "10" is "1" "0" .... This might be solvable with a separator?

Another issue, for my specific composition i need to check for "ar", "bc", "df" and not for "1" "2" ... Any solution for that as well?

thanks a lot allready!