How to test for string equality

Hi all,

I was trying to write a function that took in the name of an axis (eg "x") and generated a rotation matrix about that axis. However, I could not find any function to test if two strings were equal. It seems like this should be a fundamental part of any programming language (even one whose emphasis is on analysis).

I've check the manual and the "command help" window and found nothing. How do you test strings for equality in Igor?
hrodstein wrote:
CmpStr


Thanks!

(I feel like this should really be included in the part of the manual dedicated to Strings though -- vol. 4, chapter 1 in the section called "Strings". That seemed like the natural place to look...)
dtadams wrote:
hrodstein wrote:
CmpStr


Thanks!

(I feel like this should really be included in the part of the manual dedicated to Strings though -- vol. 4, chapter 1 in the section called "Strings". That seemed like the natural place to look...)


Yes, that should be covered somewhere in that small section.

Depending on your application, you may also be interested in the strswitch command:

String eventNameStr // assigned elsewhere
strswitch( eventNameStr )
    case "killVote":
        TitleBox warning win=$s.winName, title="Press the Done button!"
        Beep
        statusCode=2                // prevent panel from being killed.
        break
    case "mousemoved":          // to reset the warning
        TitleBox warning win=$s.winName, title=""
        break
endswitch


--Jim Prouty
Software Engineer, WaveMetrics, Inc.