comparing strings using if

isaac74's icon

Read the documentation - nothing about strings.

Tried:

if $s1 == this then 0

Doesn't work. I tried wrapping this in quotes etc, still nothing.

thanks

pdelges's icon

Unfortunately, there is no string data structure per se in Max.

But in your case sel may be an option. Maybe jstrigger is another one.

p

Chris Muir's icon

The Jash objects has a string compare

alersito's icon
Max Patch
Copy patch and select New From Clipboard in Max.
Emmanuel Jourdan's icon
Max Patch
Copy patch and select New From Clipboard in Max.

@Patrick a jstrigger solution:

alersito's icon
Max Patch
Copy patch and select New From Clipboard in Max.

@Emmanuel using your patch we have a problem if we use a list and just the same error if we use the object "sel"

Nikolas K's icon
Max Patch
Copy patch and select New From Clipboard in Max.

maybe this gives you a solution for lists ?

Nikolas

Mathieu Chamagne's icon
Max Patch
Copy patch and select New From Clipboard in Max.

zl.compare !

Roman Thilenius's icon

before [zl compare] existed, you were also already able to use certain zl combinations for this kind of thing.

when looking for a string solutions (we call "strings" "symbols" in max) always look into zl, because
it treats every symbol as a list of symbols with only one element. for example [zl reg] makes a great
place not only to store "1 2 3 4 5", but also for the message "stop".

-110