Switch statements are really just a 'convenience'. Although not as pretty to
look at, do this:
if ( s_TC == "TC_1" ) {}
else if ( s_TC == "TC_N" ) {}
[==P==]
> Is it true that VC++ doesn't support switch on string data type?
> Did anyone know how to handle the following situation?
[quoted text clipped - 17 lines]
>
> Thanks.
James Curran - 21 Nov 2005 20:20 GMT
> Switch statements are really just a 'convenience'.
That's not entirely true. Switch statement do offer optimization
possibilities over chained if()s. (Well, let's say "switch" make it easier
to recognize possible optimazations). However these are pretty much only
available when the object being switch on is an int. Which is why in C/C++
switch only works with int-like data types. The "prettiness" factor was
only realized later, at which point some languages started to shoe-horn
switch statements on other data types into their syntax.

Signature
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com