How do I determine the type of Character?
Category: System, viewed: 1776 time(s).
This example demonstrate how to define the kind of value contained in a char, whether the value is a digit, number, letter, symbol, punctuation, separator, control, whitespace or a surrogate character.
To determine the character type we can use statics method of System.Char class such as:
Char.isDigit: Any decimal digit in the range 0–9 in all Unicode locales.Char.isNumber: Any decimal digit or hexadecimal digit; this includes digits such as superscripts, subscripts, etc.Char.isLetter: Any alphabetic letter.Char.isSymbol: Any mathematical, currency, or other symbol character. Includes characters that modify surrounding characters.Char.isPunctuation: Any punctuation character.Char.isSeparator: A space separating words, a line separator, or a paragraph separator.Char.isControl: A control code in the ranges \U007F,\U0000–\U001F, and \U0080–\U009F.Char.isWhiteSpace: Any space character.Char.isSurrogate: Any surrogate character in the range \UD800–\UDFFF.
Let's see the example code below:
Download Hundreds of Complimentary Industry Resources
Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more;
all available at no cost to you. With more than 600 complimentary offers, you'll find
plenty of titles to suit your professional interests and needs.
Click Here and Sign up today!