System.String Members

The members of System.String are listed below.

See Also: Inherited members from System.Object

Public Constructors

Initializes a new instance of the string class to the value indicated by a specified pointer to an array of Unicode characters.

Initializes a new instance of the string class to the value indicated by an array of Unicode characters.

Initializes a new instance of the string class to the value indicated by a pointer to an array of 8-bit signed integers.

Initializes a new instance of the string class to the value indicated by a specified Unicode character repeated a specified number of times.

Initializes a new instance of the string class to the value indicated by a specified pointer to an array of Unicode characters, a starting character position within that array, and a length.

Initializes a new instance of the string class to the value indicated by an array of Unicode characters, a starting character position within that array, and a length.

Initializes a new instance of the string class to the value indicated by a specified pointer to an array of 8-bit signed integers, a starting position within that array, and a length.

Initializes a new instance of the string class to the value indicated by a specified pointer to an array of 8-bit signed integers, a starting position within that array, a length, and an System.Text.Encoding object.

Public Fields

static readonly
Emptystring.

Represents the empty string. This field is read-only.

Public Properties

[read-only]
default property
Chars(int)char. Gets the character at a specified position in the current instance.
[read-only]
Lengthint.

Gets the number of characters in the current string object.

Public Methods

Clone() : object

Returns a reference to this instance of string.

static
Compare(string, string) : int

Compares two specified string objects and returns an integer that indicates their relative position in the sort order.

static
Compare(string, string, bool) : int

Compares two specified string objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order.

static
Compare(string, string, StringComparison) : int

Compares two specified string objects using the specified rules, and returns an integer that indicates their relative position in the sort order.

static
Compare(string, string, bool, System.Globalization.CultureInfo) : int

Compares two specified string objects, ignoring or honoring their case, and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order.

static
Compare(string, string, System.Globalization.CultureInfo, System.Globalization.CompareOptions) : int

Compares two specified string objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order.

static
Compare(string, int, string, int, int) : int

Compares substrings of two specified string objects and returns an integer that indicates their relative position in the sort order.

static
Compare(string, int, string, int, int, bool) : int

Compares substrings of two specified string objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order.

static
Compare(string, int, string, int, int, StringComparison) : int

Compares substrings of two specified string objects using the specified rules, and returns an integer that indicates their relative position in the sort order.

static
Compare(string, int, string, int, int, bool, System.Globalization.CultureInfo) : int

Compares substrings of two specified string objects, ignoring or honoring their case and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order.

static
Compare(string, int, string, int, int, System.Globalization.CultureInfo, System.Globalization.CompareOptions) : int

Compares substrings of two specified string objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in the sort order.

static
CompareOrdinal(string, string) : int

Compares two specified string objects by evaluating the numeric values of the corresponding char objects in each string.

static
CompareOrdinal(string, int, string, int, int) : int

Compares substrings of two specified string objects by evaluating the numeric values of the corresponding char objects in each substring.

CompareTo(object) : int

Compares this instance with a specified object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified object.

CompareTo(string) : int

Compares this instance with a specified string object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string.

static
Concat(IEnumerable<string>) : string

Concatenates the members of a constructed IEnumerable`1 collection of type string.

static
Concat(object) : string

Creates the string representation of a specified object.

static
Concat(params object[]) : string

Concatenates the string representations of the elements in a specified object array.

static
Concat(params string[]) : string

Concatenates the elements of a specified string array.

static
Concat(object, object) : string

Concatenates the string representations of two specified objects.

static
Concat(string, string) : string

Concatenates two specified instances of string.

static
Concat(object, object, object) : string

Concatenates the string representations of three specified objects.

static
Concat(string, string, string) : string

Concatenates three specified instances of string.

static
Concat(object, object, object, object) : string

Concatenates the string representations of four specified objects and any objects specified in an optional variable length parameter list.

static
Concat(string, string, string, string) : string

Concatenates four specified instances of string.

static
Concat<T>(IEnumerable<T>) : string

Concatenates the members of an IEnumerable`1 implementation.

Contains(string) : bool

Returns a value indicating whether a specified substring occurs within this string.

static
Copy(string) : string

Creates a new instance of string with the same value as a specified string.

CopyTo(int, char[], int, int)

Copies a specified number of characters from a specified position in this instance to a specified position in an array of Unicode characters.

EndsWith(string) : bool

Determines whether the end of this string instance matches the specified string.

EndsWith(string, StringComparison) : bool

Determines whether the end of this string instance matches the specified string when compared using the specified comparison option.

EndsWith(string, bool, System.Globalization.CultureInfo) : bool

Determines whether the end of this string instance matches the specified string when compared using the specified culture.

override
Equals(object) : bool

Determines whether this instance and a specified object, which must also be a string object, have the same value.

Equals(string) : bool

Determines whether this instance and another specified string object have the same value.

static
Equals(string, string) : bool

Determines whether two specified string objects have the same value.

Equals(string, StringComparison) : bool

Determines whether this string and a specified string object have the same value. A parameter specifies the culture, case, and sort rules used in the comparison.

static
Equals(string, string, StringComparison) : bool

Determines whether two specified string objects have the same value. A parameter specifies the culture, case, and sort rules used in the comparison.

static
Format(string, object) : string

Replaces one or more format items in a specified string with the string representation of a specified object.

static
Format(string, params object[]) : string

Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.

static
Format(IFormatProvider, string, params object[]) : string

Replaces the format items in a specified string with the string representations of corresponding objects in a specified array. A parameter supplies culture-specific formatting information.

static
Format(string, object, object) : string

Replaces the format items in a specified string with the string representation of two specified objects.

static
Format(string, object, object, object) : string

Replaces the format items in a specified string with the string representation of three specified objects.

GetEnumerator() : CharEnumerator

Retrieves an object that can iterate through the individual characters in this string.

override
GetHashCode() : int

Returns the hash code for this string.

GetTypeCode() : TypeCode

Returns the TypeCode for class string.

IndexOf(char) : int

Reports the zero-based index of the first occurrence of the specified Unicode character in this string.

IndexOf(string) : int

Reports the zero-based index of the first occurrence of the specified string in this instance.

IndexOf(char, int) : int

Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character position.

IndexOf(string, int) : int

Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position.

IndexOf(string, StringComparison) : int

Reports the zero-based index of the first occurrence of the specified string in the current string object. A parameter specifies the type of search to use for the specified string.

IndexOf(char, int, int) : int

Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a specified character position and examines a specified number of character positions.

IndexOf(string, int, int) : int

Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position and examines a specified number of character positions.

IndexOf(string, int, StringComparison) : int

Reports the zero-based index of the first occurrence of the specified string in the current string object. Parameters specify the starting search position in the current string and the type of search to use for the specified string.

IndexOf(string, int, int, StringComparison) : int

Reports the zero-based index of the first occurrence of the specified string in the current string object. Parameters specify the starting search position in the current string, the number of characters in the current string to search, and the type of search to use for the specified string.

IndexOfAny(char[]) : int

Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.

IndexOfAny(char[], int) : int

Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position.

IndexOfAny(char[], int, int) : int

Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.

Insert(int, string) : string

Returns a new string in which a specified string is inserted at a specified index position in this instance.

static
Intern(string) : string

Retrieves the system's reference to the specified string.

static
IsInterned(string) : string

Retrieves a reference to a specified string.

IsNormalized() : bool

Indicates whether this string is in Unicode normalization form C.

IsNormalized(System.Text.NormalizationForm) : bool

Indicates whether this string is in the specified Unicode normalization form.

static
IsNullOrEmpty(string) : bool

Indicates whether the specified string is null or an string.Empty string.

static
IsNullOrWhiteSpace(string) : bool

Indicates whether a specified string is null, empty, or consists only of white-space characters.

static
Join(string, IEnumerable<string>) : string

Concatenates the members of a constructed IEnumerable`1 collection of type string, using the specified separator between each member.

static
Join(string, params object[]) : string

Concatenates the elements of an object array, using the specified separator between each element.

static
Join(string, params string[]) : string

Concatenates all the elements of a string array, using the specified separator between each element.

static
Join(string, string[], int, int) : string

Concatenates the specified elements of a string array, using the specified separator between each element.

static
Join<T>(string, IEnumerable<T>) : string

Concatenates the members of a collection, using the specified separator between each member.

LastIndexOf(char) : int

Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.

LastIndexOf(string) : int

Reports the zero-based index position of the last occurrence of a specified string within this instance.

LastIndexOf(char, int) : int

Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string.

LastIndexOf(string, int) : int

Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string.

LastIndexOf(string, StringComparison) : int

Reports the zero-based index of the last occurrence of a specified string within the current string object. A parameter specifies the type of search to use for the specified string.

LastIndexOf(char, int, int) : int

Reports the zero-based index position of the last occurrence of the specified Unicode character in a substring within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.

LastIndexOf(string, int, int) : int

Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.

LastIndexOf(string, int, StringComparison) : int

Reports the zero-based index of the last occurrence of a specified string within the current string object. The search starts at a specified character position and proceeds backward toward the beginning of the string. A parameter specifies the type of comparison to perform when searching for the specified string.

LastIndexOf(string, int, int, StringComparison) : int

Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for the specified number of character positions. A parameter specifies the type of comparison to perform when searching for the specified string.

LastIndexOfAny(char[]) : int

Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array.

LastIndexOfAny(char[], int) : int

Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the string.

LastIndexOfAny(char[], int, int) : int

Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.

Normalize() : string

Returns a new string whose textual value is the same as this string, but whose binary representation is in Unicode normalization form C.

Normalize(System.Text.NormalizationForm) : string

Returns a new string whose textual value is the same as this string, but whose binary representation is in the specified Unicode normalization form.

PadLeft(int) : string

Returns a new string that right-aligns the characters in this instance by padding them with spaces on the left, for a specified total length.

PadLeft(int, char) : string

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length.

PadRight(int) : string

Returns a new string that left-aligns the characters in this string by padding them with spaces on the right, for a specified total length.

PadRight(int, char) : string

Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length.

Remove(int) : string

Returns a new string in which all the characters in the current instance, beginning at a specified position and continuing through the last position, have been deleted.

Remove(int, int) : string

Returns a new string in which a specified number of characters in the current instance beginning at a specified position have been deleted.

Replace(char, char) : string

Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another specified Unicode character.

Replace(string, string) : string

Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string.

Split(params char[]) : string[]

Returns a string array that contains the substrings in this instance that are delimited by elements of a specified Unicode character array.

Split(char[], int) : string[]

Returns a string array that contains the substrings in this instance that are delimited by elements of a specified Unicode character array. A parameter specifies the maximum number of substrings to return.

Split(char[], StringSplitOptions) : string[]

Returns a string array that contains the substrings in this string that are delimited by elements of a specified Unicode character array. A parameter specifies whether to return empty array elements.

Split(string[], StringSplitOptions) : string[]

Returns a string array that contains the substrings in this string that are delimited by elements of a specified string array. A parameter specifies whether to return empty array elements.

Split(char[], int, StringSplitOptions) : string[]

Returns a string array that contains the substrings in this string that are delimited by elements of a specified Unicode character array. Parameters specify the maximum number of substrings to return and whether to return empty array elements.

Split(string[], int, StringSplitOptions) : string[]

Returns a string array that contains the substrings in this string that are delimited by elements of a specified string array. Parameters specify the maximum number of substrings to return and whether to return empty array elements.

StartsWith(string) : bool

Determines whether the beginning of this string instance matches the specified string.

StartsWith(string, StringComparison) : bool

Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option.

StartsWith(string, bool, System.Globalization.CultureInfo) : bool

Determines whether the beginning of this string instance matches the specified string when compared using the specified culture.

Substring(int) : string

Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string.

Substring(int, int) : string

Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.

ToCharArray() : char[]

Copies the characters in this instance to a Unicode character array.

ToCharArray(int, int) : char[]

Copies the characters in a specified substring in this instance to a Unicode character array.

ToLower() : string

Returns a copy of this string converted to lowercase.

ToLower(System.Globalization.CultureInfo) : string

Returns a copy of this string converted to lowercase, using the casing rules of the specified culture.

ToLowerInvariant() : string

Returns a copy of this string object converted to lowercase using the casing rules of the invariant culture.

override
ToString() : string

Returns this instance of string; no actual conversion is performed.

ToString(IFormatProvider) : string

Returns this instance of string; no actual conversion is performed.

ToUpper() : string

Returns a copy of this string converted to uppercase.

ToUpper(System.Globalization.CultureInfo) : string

Returns a copy of this string converted to uppercase, using the casing rules of the specified culture.

ToUpperInvariant() : string

Returns a copy of this string object converted to uppercase using the casing rules of the invariant culture.

Trim() : string

Removes all leading and trailing white-space characters from the current string object.

Trim(params char[]) : string

Removes all leading and trailing occurrences of a set of characters specified in an array from the current string object.

TrimEnd(params char[]) : string

Removes all trailing occurrences of a set of characters specified in an array from the current string object.

TrimStart(params char[]) : string

Removes all leading occurrences of a set of characters specified in an array from the current string object.

Public Operators

static
Equality(string, string)

Determines whether two specified strings have the same value.

static
Inequality(string, string)

Determines whether two specified strings have different values.

Explicitly Implemented Interface Members

IEnumerable<char>.GetEnumeratorThis method is implemented to support the System.Collections.Generics.IEnumerable<char> interface.
IEnumerable.GetEnumerator

Returns an enumerator that iterates through the current string object.

IConvertible.ToBoolean

For a description of this member, see IConvertible.ToBoolean(IFormatProvider).

IConvertible.ToByte

For a description of this member, see IConvertible.ToByte(IFormatProvider).

IConvertible.ToChar

For a description of this member, see IConvertible.ToChar(IFormatProvider).

IConvertible.ToDateTime

For a description of this member, see IConvertible.ToDateTime(IFormatProvider).

IConvertible.ToDecimal

For a description of this member, see IConvertible.ToDecimal(IFormatProvider).

IConvertible.ToDouble

For a description of this member, see IConvertible.ToDouble(IFormatProvider).

IConvertible.ToInt16

For a description of this member, see IConvertible.ToInt16(IFormatProvider).

IConvertible.ToInt32

For a description of this member, see IConvertible.ToInt32(IFormatProvider).

IConvertible.ToInt64

For a description of this member, see IConvertible.ToInt64(IFormatProvider).

IConvertible.ToSByte

For a description of this member, see IConvertible.ToSByte(IFormatProvider).

IConvertible.ToSingle

For a description of this member, see IConvertible.ToSingle(IFormatProvider).

IConvertible.ToType

For a description of this member, see IConvertible.ToType(Type, IFormatProvider).

IConvertible.ToUInt16

For a description of this member, see IConvertible.ToUInt16(IFormatProvider).

IConvertible.ToUInt32

For a description of this member, see IConvertible.ToUInt32(IFormatProvider).

IConvertible.ToUInt64

For a description of this member, see IConvertible.ToUInt64(IFormatProvider).