D
Dinsdale
I would like to compare a string value to a pre-determined list of
other strings. Is there a simple way to do this in one statements like
this:
if(strMystring.ToUpper() == ("STRING1"| "STRING2"| "STRINGX"))
{}
This syntax doesn't work (and in fact I'm not quite sure what this
statement really is saying) but I'd like to be able to do *something*
like this. One suggestion was to add the compare strings to an
arraylist and do a binary search.
It's sad that my knowledge of and/or operators is so lacking. If anyone
knows of a good link to explain the difference between &&, &, ||, | i
would be greatly appreciative. I don't know how I have survived
without knowing these things but here I am. :-}
Some examples of syntax I don't really understand:
Example 1:
if ((eventMask & Win32Com.EV_CTS) != 0)
{
i |= Win32Com.MS_CTS_ON;
}
Example 2:
if (!Win32Com.SetCommMask(hPort, Win32Com.EV_RXCHAR |
Win32Com.EV_TXEMPTY | Win32Com.EV_CTS | Win32Com.EV_DSR
| Win32Com.EV_BREAK | Win32Com.EV_RLSD | Win32Com.EV_RING |
Win32Com.EV_ERR))
Any info would be helpful. I don't mind doing the heavy lifting, I just
need a bit of direction.
Cheers,
Russ
other strings. Is there a simple way to do this in one statements like
this:
if(strMystring.ToUpper() == ("STRING1"| "STRING2"| "STRINGX"))
{}
This syntax doesn't work (and in fact I'm not quite sure what this
statement really is saying) but I'd like to be able to do *something*
like this. One suggestion was to add the compare strings to an
arraylist and do a binary search.
It's sad that my knowledge of and/or operators is so lacking. If anyone
knows of a good link to explain the difference between &&, &, ||, | i
would be greatly appreciative. I don't know how I have survived
without knowing these things but here I am. :-}
Some examples of syntax I don't really understand:
Example 1:
if ((eventMask & Win32Com.EV_CTS) != 0)
{
i |= Win32Com.MS_CTS_ON;
}
Example 2:
if (!Win32Com.SetCommMask(hPort, Win32Com.EV_RXCHAR |
Win32Com.EV_TXEMPTY | Win32Com.EV_CTS | Win32Com.EV_DSR
| Win32Com.EV_BREAK | Win32Com.EV_RLSD | Win32Com.EV_RING |
Win32Com.EV_ERR))
Any info would be helpful. I don't mind doing the heavy lifting, I just
need a bit of direction.
Cheers,
Russ