Maybe I’m missing something obvious, but is there a simpler way to check if a character is a basic latin letter (a-z) other than converting to a string and using Regex?: For example:
public static bool IsBasicLetter(Char c) {
return Regex.IsMatch(c.ToString(), "[a-z]", RegexOptions.IgnoreCase);
}
Char.IsLetter matches hundreds of letter characters from many alphabets. I could directly check the code points, but that feels sketchy:
public static bool IsBasicLetter(Char c) {
int cInt = c;
return !(cInt < 65 || cInt > 122 || (cInt > 90 & cInt < 97));
}
Your second bit of code looks a lot better if you use character literals: