C # System.String supports UTF-32 just fine, but you cannot iterate over a string like this is a System.Char array or use IEnumerable.
eg:
// iterating through a string NO UTF-32 SUPPORT for (int i = 0; i < sample.Length; ++i) { if (Char.IsDigit(sample[i])) { Console.WriteLine("IsDigit"); } else if (Char.IsLetter(sample[i])) { Console.WriteLine("IsLetter"); } } // iterating through a string WITH UTF-32 SUPPORT for (int i = 0; i < sample.Length; ++i) { if (Char.IsDigit(sample, i)) { Console.WriteLine("IsDigit"); } else if (Char.IsLetter(sample, i)) { Console.WriteLine("IsLetter"); } if (Char.IsSurrogate(sample, i)) { ++i; } }
Note the slight difference in the calls to Char.IsDigit and Char.IsLetter. And that String.Length is always the number of 16-bit "characters", not the number of "characters" in the sense of UTF-32.
Disable the theme, but UTF-32 support is completely unnecessary for an application for processing international languages, unless you have a specific business case for an obscure historical / technical language.
Luke tigaris
source share