Hi, XML-Man.

Sure, Switch-case is more elegant, but it won't work.

The ANSI C specification says that switch can only be used
with an integer type, not a string or c-string.

Whatever solution you use, you must use some type of comparison
for strings, such as strcmp, or one of the utility functions such as
::Equals.

Sorry, but that's the language.

--Carl





"XML Man" <[EMAIL PROTECTED]> on 06/18/2001 09:46:31 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  getNodeValue().transcode() - Explanation


Thank you everybody.

I only typed two possibilities ("John" and "Tom") only not
to write too much, but the fact is that I've got 9
possibilities, and I do not want to use if-then-else, but
switch-case.

I tested with:
value = attr.getNodeValue().transcode()
if (strcmp(value,"John")==0)...
if (strcmp(value,"Tom")==0)...
if (strcmp(value,"Mary")==0)...

It works but, in my opinion, it's more elegant switch-case,
isn't it?

_______________________________________________________________________
Tu correo gratuito en HispaVista - http://www.hispavista.com/altacorreo/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to