I would like to check, in C#, if a char contains a non-ASCII character. What is the best way to check for special characters such as 志
or Ω
?
The ' |= ' symbol is the bitwise OR assignment operator.
In mathematics, the tilde often represents approximation, especially when used in duplicate, and is sometimes called the "equivalency sign." In regular expressions, the tilde is used as an operator in pattern matching, and in C programming, it is used as a bitwise operator representing a unary negation (i.e., "bitwise ...
ASCII ranges from 0 - 127, so just check for that range:
char c = 'a';//or whatever char you have bool isAscii = c < 128;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With