C#StringLength

Gets the number of characters in the string.

Syntax

str.Length

Example

Enter values below to update the example in real time.

string
Console
WriteLine
string text = "Hello";
Console.WriteLine(text.Length);   // 5