You can use the string.Length property to get an integer representing the length of a string. In most cases, length means–the number of characters.
1 2 3 4 5 6 7 | // 3 Latin (ASCII) charactersstring simple = "abc";// 2 other characters: U+0100, E+4E01string other = "Ā丁";Console.WriteLine(string.Format("Length 1 = {0}", simple.Length));Console.WriteLine(string.Format("Length 2 = {0}", other.Length)); |
It’s important to note that the Length property returns the number of individual Char objects that make up the string. This can be different from the actual number of Unicode characters.

