C# System.Char – 2 Questions per Function (Moderate–High)
Use these questions for associate assessments and interview practice.
IsDigit
- Count numeric characters in a string containing spaces and digits.
- From "AB12C03Z9", extract digits and convert to an integer array.
IsLetter
- Validate that a password contains at least 5 alphabetic characters.
- Remove everything except letters and spaces.
IsLetterOrDigit
- Strip all special characters but keep letters and digits.
- Validate username: alphanumeric only, length ≥ 8.
IsUpper
- Count uppercase letters in a paragraph.
- Detect if more than 60% characters are uppercase.
IsLower
- Count lowercase letters.
- Convert only lowercase letters to uppercase.
IsWhiteSpace
- Count spaces, tabs, and newlines.
- Replace multiple whitespaces with one.
IsSymbol
- Extract mathematical symbols.
- Ensure product code contains at least one symbol.
IsPunctuation
- Remove punctuation from text.
- Count punctuation marks.
IsControl
- Detect invisible control characters.
- Clean ASCII control characters from logs.
IsNumber
- Detect Unicode numeric characters.
- Count numerics including Roman numerals.
IsSeparator
- Identify Unicode separators.
- Split string using separator chars.
IsSurrogate
- Detect emoji surrogate pairs.
- Validate UTF-16 surrogate correctness.
IsHighSurrogate
- Find indices of high surrogates.
- Verify surrogate ordering.
IsLowSurrogate
- Ensure every low surrogate has high surrogate.
- Repair broken UTF-16 text.
ToUpper
- Convert only vowels to uppercase.
- Capitalize first letter of each word.
ToLower
- Convert only consonants to lowercase.
- Normalize input ignoring case.
ToUpperInvariant
- Culture-independent case conversion.
- Compare product codes ignoring culture.
ToLowerInvariant
- Normalize database identifiers.
- Case-insensitive dictionary lookup.
GetUnicodeCategory
- Count by Unicode category.
- Detect emoji vs punctuation vs letters.
Parse
- Convert char '9' to integer.
- Validate single-character menu input.
TryParse
- Accept only valid char commands.
- Validate keyboard input.
Equals
- Compare two chars ignoring case.
- Detect duplicate consecutive chars.
CompareTo
- Manual character sorting.
- Lexicographical order check.
ToString
- Comma-separated characters.
- Build output using char-to-string only.
MinValue
- Validate char range boundaries.
- Detect invalid binary char values.
MaxValue
- Check Unicode boundary cases.
- Validate char serialization.