Shop OBEX P1 Docs P2 Docs Learn Events
comparing strings in a case structure — Parallax Forums

comparing strings in a case structure

OwenOwen Posts: 100
edited 2007-06-20 22:17 in Propeller 1
is it posible to compare strings in a case structure? I have tried with out any luck and resorted to if statments andcomparing the strings with strcomp.

Owen

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-20 22:17
    The only reasonable way to compare strings is with STRCOMP and that's not really workable with a case statement. One option would be to write a separate string lookup routine that returns an integer ordinal number for the string or the starting offset of the string in a table and use that for the case statement. It would be pretty straightforward to have a table of strings, each terminated with a zero byte, probably in a DAT section.
Sign In or Register to comment.