Strings

String Length in C#

Returns the number of characters in a string.


Syntax
int length = stringName.Length;

Notes

Spaces count as characters.


Example
string name = "Anthony";
int nameLength = name.Length;
Console.WriteLine("The name " + name + " contains " + nameLength + "letters.");

< String Variables   |   String Compare >

© 2019 SyntaxDB. All Rights Reserved.