Wednesday, June 11, 2008

System.String

An index is the position of a character within a string. The first character in the string is at index 0. The length of a string is the number of characters it is made up of. The last accessible index of a string instance is System.String.Length - 1.

Strings are immutable; once created, the contents of a String do not change. Combining operations, such as System.String.Replace(System.Char,System.Char), cannot alter existing strings. Instead, such operations return a new string that contains the results of the operation, an unchanged string, or the null value. To perform modifications to a String use the StringBuilder .

The following characters are considered white space when present in a String instance: 0x9, 0xA, 0xB, 0xC, 0xD, 0x20, 0xA0, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x200B, 0x3000, and 0xFEFF. The null character is defined as hexadecimal 0x00.

The String(String) constructor is omitted for performance reasons. If you need a copy of a String, consider using System.String.Copy(System.String) or the StringBuilder class.

To insert a formatted string representation of an object into a string, use the System.String.Format(System.String,System.Object) methods. These methods take one or more arguments to be formatted, and a format string.

To insert a formatted string representation of an object into a string, use the System.String.Format(System.String,System.Object) methods. These methods take one or more arguments to be formatted, and a format string.

No comments: