comparing strings

Discuss problems and solutions.
Post Reply
dBlicious
Newbie
Posts: 25
Joined: 12 Jan 2013 06:49

comparing strings

Post by dBlicious »

If I enter 'cat' == 'cat' in monitor value, I would expect to get 1, but instead the editor crashes. Same if I enter 'cat' != 'dog'. If i do the same inside a script, it doesn't crash, but I don't get a result. Is there another way to compare strings? Is this a bug?

Thanks,
A
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: comparing strings

Post by Macciza »

Hi
Thanks for the report - Confirmed -I will forward it to be looked into . . .

Try 'cat'=='cat?1:0 - short hand version of if ? then : else . . .

In a script - decl test = 'cat'=='cat'?1:0;
Monitor.value=test;

or

decl test;
if ('cat'=='cat') test=1;
Monitor2.value=test;

If things don't go as planned, often being more verbose/explicit can help . . .

Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
dBlicious
Newbie
Posts: 25
Joined: 12 Jan 2013 06:49

Re: comparing strings

Post by dBlicious »

Thanks MM, I will check out your suggestions. Sorry for not being more detailed. I try to simplify the problem so it's easy to find and duplicate, but maybe I oversimplified. In any case, I appreciate your help!
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: comparing strings

Post by Macciza »

No wotties

The syntax given does work -
I made up a quick project to check your error and find a solution . . .

All good
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Post Reply