3.10. Strings

The System.String class contains methods to manipulate strings. Using methods of this class, we can determine a string's length, search for substrings, change the case of a string, compare two strings, split strings, and perform other string-related operations. Once created, an instance of a String class cannot be changed – all methods that modify a string return a new instance that contains the modification. The StringBuilder class in the System.Text namespace should be used to create strings, the content of which can be modified. In Microsoft .NET, strings are zero-based, that is, the first character in a string has the index zero.

The String class implements IComparable, ICloneable, IConvertible, and IEnumerable interfaces. ...

Get A Programmer's Guide to .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.