Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!usc!apple!bionet!agate!ucbvax!edinburgh.ac.uk!R.J.Hare From: R.J.Hare@edinburgh.ac.uk Newsgroups: comp.lang.icon Subject: Case statement and string scanning Message-ID: <25.Feb.91..16:53:26.gmt..060303@EMAS-A> Date: 25 Feb 91 16:53:26 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 27 I have a program in which I repetitively read in a string. According to what the string contains, I do a variety of things - set up an option, display a file, execute a system command, etc. I would like to do this (fairly obviously) in a case statement, but the test I am carrying out are so varied that I can't quite see how to fit them into a case statement, for example, I will be doing: if match("!",string) then... if match(";",string) then... if find("*",string) then... if type(string) == "integer" then... ...some default action... Any ideas on how I may set this up in a case statement please? Note that because a string starts with "!", this does not preclude the possibility of it also including a "*" elsewhere, so I guess a series of simple if statements won't do the job as in such a circumstance, 2 of the blocks of code would be executed... I guess that there is a ridiculously simple answer, but I don't see it yet! Thanks. Roger Hare.