ZBrushCentral

Any easy way to test strings for equality?

Correct me if I’m wrong, but the ‘=’ operator does not seem to work for strings. Is there another easy way to do this? (I can think of some ugly ways using the string functions, but would prefer to do it the “right” way if can.)

Thanks,
Ken

If you have the ZScript Command Reference Manual , it answers your question… Look under StrFind.

Sven

I think you may want to check for strFind and length. Otherwise you may find.
“Word” in “MyWord”, but it is not equal. so if you check length first and then strFind if that is true it will be more accurate.

I could be wrong but, at least give it a look.

Chris Reid

Let us know what you find out.:qu:

That’s basically the way to do it, though it will depend on what you are evaluating. If you are scanning a text file using StrFind in a loop then StrLength won’t necessarily help but you can search for spaces or line breaks along with other characters. In this case you need to bear in mind that StrFind will only scan up to 255 characters and adjust your looping accordingly (i.e. so that the starting points of each loop will catch all and not cut the string you’re looking for in half, missing it).