Re: Switch on Strings

On Sat, 14 Jan 2006 00:32:18 GMT, fb <fb@xxxxxxxxx> wrote, quoted or
indirectly quoted someone who said :

>myColor is a String being read in from an HTML file PARAM line.
>The above code doesn't work, because switch doesn't work with strings.
>So I was wondering how else I can do this...

you do it with enums. See

You convert your switch string to an enum with valueOf and use enum
constants instead of strings on your case labels.
Canadian Mind Products, Roedy Green. Java custom programming, consulting and coaching.