mscorlib(4.0.0.0) API with additions
System.String Class Reference

Represents text as a sequence of UTF-16 code units.To browse the .NET Framework source code for this type, see the Reference Source. More...

Inheritance diagram for System.String:
[legend]
Collaboration diagram for System.String:
[legend]

Public Member Functions

override bool Equals (object obj)
 Determines whether this instance and a specified object, which must also be a T:System.String object, have the same value. More...
 
bool Equals (string value)
 Determines whether this instance and another specified T:System.String object have the same value. More...
 
bool Equals (string value, StringComparison comparisonType)
 Determines whether this string and a specified T:System.String object have the same value. A parameter specifies the culture, case, and sort rules used in the comparison. More...
 
unsafe void CopyTo (int sourceIndex, char[] destination, int destinationIndex, int count)
 Copies a specified number of characters from a specified position in this instance to a specified position in an array of Unicode characters. More...
 
unsafe char [] ToCharArray ()
 Copies the characters in this instance to a Unicode character array. More...
 
unsafe char [] ToCharArray (int startIndex, int length)
 Copies the characters in a specified substring in this instance to a Unicode character array. More...
 
unsafe override int GetHashCode ()
 Returns the hash code for this string. More...
 
string [] Split (params char[] separator)
 Splits a string into substrings that are based on the characters in an array. More...
 
string [] Split (char[] separator, int count)
 Splits a string into a maximum number of substrings based on the characters in an array. You also specify the maximum number of substrings to return. More...
 
string [] Split (char[] separator, StringSplitOptions options)
 Splits a string into substrings based on the characters in an array. You can specify whether the substrings include empty array elements. More...
 
string [] Split (char[] separator, int count, StringSplitOptions options)
 Splits a string into a maximum number of substrings based on the characters in an array. More...
 
string [] Split (string[] separator, StringSplitOptions options)
 Splits a string into substrings based on the strings in an array. You can specify whether the substrings include empty array elements. More...
 
string [] Split (string[] separator, int count, StringSplitOptions options)
 Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the substrings include empty array elements. More...
 
string Substring (int startIndex)
 Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string. More...
 
string Substring (int startIndex, int length)
 Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length. More...
 
string Trim (params char[] trimChars)
 Removes all leading and trailing occurrences of a set of characters specified in an array from the current T:System.String object. More...
 
string TrimStart (params char[] trimChars)
 Removes all leading occurrences of a set of characters specified in an array from the current T:System.String object. More...
 
string TrimEnd (params char[] trimChars)
 Removes all trailing occurrences of a set of characters specified in an array from the current T:System.String object. More...
 
unsafe String (char *value)
 Initializes a new instance of the T:System.String class to the value indicated by a specified pointer to an array of Unicode characters. More...
 
unsafe String (char *value, int startIndex, int length)
 Initializes a new instance of the T:System.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. More...
 
unsafe String (sbyte *value)
 Initializes a new instance of the T:System.String class to the value indicated by a pointer to an array of 8-bit signed integers. More...
 
unsafe String (sbyte *value, int startIndex, int length)
 Initializes a new instance of the T:System.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. More...
 
unsafe String (sbyte *value, int startIndex, int length, Encoding enc)
 Initializes a new instance of the T:System.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 T:System.Text.Encoding object. More...
 
bool IsNormalized ()
 Indicates whether this string is in Unicode normalization form C. More...
 
bool IsNormalized (NormalizationForm normalizationForm)
 Indicates whether this string is in the specified Unicode normalization form. More...
 
string Normalize ()
 Returns a new string whose textual value is the same as this string, but whose binary representation is in Unicode normalization form C. More...
 
string Normalize (NormalizationForm normalizationForm)
 Returns a new string whose textual value is the same as this string, but whose binary representation is in the specified Unicode normalization form. More...
 
 String (char[] value, int startIndex, int length)
 Initializes a new instance of the T:System.String class to the value indicated by an array of Unicode characters, a starting character position within that array, and a length. More...
 
 String (char[] value)
 Initializes a new instance of the T:System.String class to the value indicated by an array of Unicode characters. More...
 
 String (char c, int count)
 Initializes a new instance of the T:System.String class to the value indicated by a specified Unicode character repeated a specified number of times. More...
 
int CompareTo (object value)
 Compares this instance with a specified T:System.Object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified T:System.Object. More...
 
int CompareTo (string strB)
 Compares this instance with a specified T:System.String object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string. More...
 
bool Contains (string value)
 Returns a value indicating whether a specified substring occurs within this string. More...
 
bool EndsWith (string value)
 Determines whether the end of this string instance matches the specified string. More...
 
bool EndsWith (string value, StringComparison comparisonType)
 Determines whether the end of this string instance matches the specified string when compared using the specified comparison option. More...
 
bool EndsWith (string value, bool ignoreCase, CultureInfo culture)
 Determines whether the end of this string instance matches the specified string when compared using the specified culture. More...
 
int IndexOf (char value)
 Reports the zero-based index of the first occurrence of the specified Unicode character in this string. More...
 
int IndexOf (char value, int startIndex)
 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. More...
 
int IndexOf (char value, int startIndex, int count)
 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. More...
 
int IndexOfAny (char[] anyOf)
 Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. More...
 
int IndexOfAny (char[] anyOf, int startIndex)
 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. More...
 
int IndexOfAny (char[] anyOf, int startIndex, int count)
 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. More...
 
int IndexOf (string value)
 Reports the zero-based index of the first occurrence of the specified string in this instance. More...
 
int IndexOf (string value, int startIndex)
 Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position. More...
 
int IndexOf (string value, int startIndex, int count)
 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. More...
 
int IndexOf (string value, StringComparison comparisonType)
 Reports the zero-based index of the first occurrence of the specified string in the current T:System.String object. A parameter specifies the type of search to use for the specified string. More...
 
int IndexOf (string value, int startIndex, StringComparison comparisonType)
 Reports the zero-based index of the first occurrence of the specified string in the current T:System.String object. Parameters specify the starting search position in the current string and the type of search to use for the specified string. More...
 
int IndexOf (string value, int startIndex, int count, StringComparison comparisonType)
 Reports the zero-based index of the first occurrence of the specified string in the current T:System.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. More...
 
int LastIndexOf (char value)
 Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. More...
 
int LastIndexOf (char value, int startIndex)
 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. More...
 
int LastIndexOf (char value, int startIndex, int count)
 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. More...
 
int LastIndexOfAny (char[] anyOf)
 Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. More...
 
int LastIndexOfAny (char[] anyOf, int startIndex)
 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. More...
 
int LastIndexOfAny (char[] anyOf, int startIndex, int count)
 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. More...
 
int LastIndexOf (string value)
 Reports the zero-based index position of the last occurrence of a specified string within this instance. More...
 
int LastIndexOf (string value, int startIndex)
 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. More...
 
int LastIndexOf (string value, int startIndex, int count)
 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. More...
 
int LastIndexOf (string value, StringComparison comparisonType)
 Reports the zero-based index of the last occurrence of a specified string within the current T:System.String object. A parameter specifies the type of search to use for the specified string. More...
 
int LastIndexOf (string value, int startIndex, StringComparison comparisonType)
 Reports the zero-based index of the last occurrence of a specified string within the current T:System.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. More...
 
int LastIndexOf (string value, int startIndex, int count, StringComparison comparisonType)
 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. More...
 
string PadLeft (int totalWidth)
 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. More...
 
string PadLeft (int totalWidth, char paddingChar)
 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. More...
 
string PadRight (int totalWidth)
 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. More...
 
string PadRight (int totalWidth, char paddingChar)
 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. More...
 
bool StartsWith (string value)
 Determines whether the beginning of this string instance matches the specified string. More...
 
bool StartsWith (string value, StringComparison comparisonType)
 Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option. More...
 
bool StartsWith (string value, bool ignoreCase, CultureInfo culture)
 Determines whether the beginning of this string instance matches the specified string when compared using the specified culture. More...
 
string ToLower ()
 Returns a copy of this string converted to lowercase. More...
 
string ToLower (CultureInfo culture)
 Returns a copy of this string converted to lowercase, using the casing rules of the specified culture. More...
 
string ToLowerInvariant ()
 Returns a copy of this T:System.String object converted to lowercase using the casing rules of the invariant culture. More...
 
string ToUpper ()
 Returns a copy of this string converted to uppercase. More...
 
string ToUpper (CultureInfo culture)
 Returns a copy of this string converted to uppercase, using the casing rules of the specified culture. More...
 
string ToUpperInvariant ()
 Returns a copy of this T:System.String object converted to uppercase using the casing rules of the invariant culture. More...
 
override string ToString ()
 Returns this instance of T:System.String; no actual conversion is performed. More...
 
string ToString (IFormatProvider provider)
 Returns this instance of T:System.String; no actual conversion is performed. More...
 
object Clone ()
 Returns a reference to this instance of T:System.String. More...
 
string Trim ()
 Removes all leading and trailing white-space characters from the current T:System.String object. More...
 
unsafe string Insert (int startIndex, string value)
 Returns a new string in which a specified string is inserted at a specified index position in this instance. More...
 
string Replace (char oldChar, char newChar)
 Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another specified Unicode character. More...
 
string Replace (string oldValue, string newValue)
 Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string. More...
 
unsafe string Remove (int startIndex, int count)
 Returns a new string in which a specified number of characters in the current instance beginning at a specified position have been deleted. More...
 
string Remove (int startIndex)
 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. More...
 
TypeCode GetTypeCode ()
 Returns the T:System.TypeCode for class T:System.String. More...
 
CharEnumerator GetEnumerator ()
 Retrieves an object that can iterate through the individual characters in this string. More...
 
- Public Member Functions inherited from System.Collections.IEnumerable< char >
IEnumerator GetEnumerator ()
 Returns an enumerator that iterates through a collection. More...
 
- Public Member Functions inherited from System.IEquatable< string >
bool Equals (T other)
 Indicates whether the current object is equal to another object of the same type. More...
 

Static Public Member Functions

static string Join (string separator, params string[] value)
 Concatenates all the elements of a string array, using the specified separator between each element. More...
 
static string Join (string separator, params object[] values)
 Concatenates the elements of an object array, using the specified separator between each element. More...
 
static string Join< T > (string separator, IEnumerable< T > values)
 Concatenates the members of a collection, using the specified separator between each member. More...
 
static string Join (string separator, IEnumerable< string > values)
 Concatenates the members of a constructed T:System.Collections.Generic.IEnumerable`1 collection of type T:System.String, using the specified separator between each member. More...
 
static unsafe string Join (string separator, string[] value, int startIndex, int count)
 Concatenates the specified elements of a string array, using the specified separator between each element. More...
 
static bool Equals (string a, string b)
 Determines whether two specified T:System.String objects have the same value. More...
 
static bool Equals (string a, string b, StringComparison comparisonType)
 Determines whether two specified T:System.String objects have the same value. A parameter specifies the culture, case, and sort rules used in the comparison. More...
 
static bool operator== (string a, string b)
 Determines whether two specified strings have the same value. More...
 
static bool operator != (string a, string b)
 Determines whether two specified strings have different values. More...
 
static bool IsNullOrEmpty (string value)
 Indicates whether the specified string is null or an F:System.String.Empty string. More...
 
static bool IsNullOrWhiteSpace (string value)
 Indicates whether a specified string is null, empty, or consists only of white-space characters. More...
 
static int Compare (string strA, string strB)
 Compares two specified T:System.String objects and returns an integer that indicates their relative position in the sort order. More...
 
static int Compare (string strA, string strB, bool ignoreCase)
 Compares two specified T:System.String objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order. More...
 
static int Compare (string strA, string strB, StringComparison comparisonType)
 Compares two specified T:System.String objects using the specified rules, and returns an integer that indicates their relative position in the sort order. More...
 
static int Compare (string strA, string strB, CultureInfo culture, CompareOptions options)
 Compares two specified T:System.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. More...
 
static int Compare (string strA, string strB, bool ignoreCase, CultureInfo culture)
 Compares two specified T:System.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. More...
 
static int Compare (string strA, int indexA, string strB, int indexB, int length)
 Compares substrings of two specified T:System.String objects and returns an integer that indicates their relative position in the sort order. More...
 
static int Compare (string strA, int indexA, string strB, int indexB, int length, bool ignoreCase)
 Compares substrings of two specified T:System.String objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order. More...
 
static int Compare (string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture)
 Compares substrings of two specified T:System.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. More...
 
static int Compare (string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options)
 Compares substrings of two specified T:System.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. More...
 
static int Compare (string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType)
 Compares substrings of two specified T:System.String objects using the specified rules, and returns an integer that indicates their relative position in the sort order. More...
 
static int CompareOrdinal (string strA, string strB)
 Compares two specified T:System.String objects by evaluating the numeric values of the corresponding T:System.Char objects in each string. More...
 
static int CompareOrdinal (string strA, int indexA, string strB, int indexB, int length)
 Compares substrings of two specified T:System.String objects by evaluating the numeric values of the corresponding T:System.Char objects in each substring. More...
 
static string Format (string format, object arg0)
 Replaces one or more format items in a specified string with the string representation of a specified object. More...
 
static string Format (string format, object arg0, object arg1)
 Replaces the format items in a specified string with the string representation of two specified objects. More...
 
static string Format (string format, object arg0, object arg1, object arg2)
 Replaces the format items in a specified string with the string representation of three specified objects. More...
 
static string Format (string format, params object[] args)
 Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. More...
 
static string Format (IFormatProvider provider, string format, object arg0)
 Replaces the format item or items in a specified string with the string representation of the corresponding object. A parameter supplies culture-specific formatting information. More...
 
static string Format (IFormatProvider provider, string format, object arg0, object arg1)
 Replaces the format items in a specified string with the string representation of two specified objects. A parameter supplies culture-specific formatting information. More...
 
static string Format (IFormatProvider provider, string format, object arg0, object arg1, object arg2)
 Replaces the format items in a specified string with the string representation of three specified objects. An parameter supplies culture-specific formatting information. More...
 
static string Format (IFormatProvider provider, string format, params object[] args)
 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. More...
 
static unsafe string Copy (string str)
 Creates a new instance of T:System.String with the same value as a specified T:System.String. More...
 
static string Concat (object arg0)
 Creates the string representation of a specified object. More...
 
static string Concat (object arg0, object arg1)
 Concatenates the string representations of two specified objects. More...
 
static string Concat (object arg0, object arg1, object arg2)
 Concatenates the string representations of three specified objects. More...
 
static string Concat (object arg0, object arg1, object arg2, object arg3, __arglist)
 
static string Concat (params object[] args)
 Concatenates the string representations of the elements in a specified T:System.Object array. More...
 
static string Concat< T > (IEnumerable< T > values)
 Concatenates the members of an T:System.Collections.Generic.IEnumerable`1 implementation. More...
 
static string Concat (IEnumerable< string > values)
 Concatenates the members of a constructed T:System.Collections.Generic.IEnumerable`1 collection of type T:System.String. More...
 
static string Concat (string str0, string str1)
 Concatenates two specified instances of T:System.String. More...
 
static string Concat (string str0, string str1, string str2)
 Concatenates three specified instances of T:System.String. More...
 
static string Concat (string str0, string str1, string str2, string str3)
 Concatenates four specified instances of T:System.String. More...
 
static string Concat (params string[] values)
 Concatenates the elements of a specified T:System.String array. More...
 
static string Intern (string str)
 Retrieves the system's reference to the specified T:System.String. More...
 
static string IsInterned (string str)
 Retrieves a reference to a specified T:System.String. More...
 

Static Public Attributes

static readonly string Empty
 Represents the empty string. This field is read-only. More...
 

Properties

char this[int index] [get]
 Gets the T:System.Char object at a specified position in the current T:System.String object. More...
 
int Length [get]
 Gets the number of characters in the current T:System.String object. More...
 

Detailed Description

Represents text as a sequence of UTF-16 code units.To browse the .NET Framework source code for this type, see the Reference Source.

Definition at line 18 of file String.cs.

Constructor & Destructor Documentation

◆ String() [1/8]

unsafe System.String.String ( char *  value)

Initializes a new instance of the T:System.String class to the value indicated by a specified pointer to an array of Unicode characters.

Parameters
valueA pointer to a null-terminated array of Unicode characters.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe current process does not have read access to all the addressed characters.
T:System.ArgumentExceptionvalue specifies an array that contains an invalid Unicode character, or value specifies an address less than 64000.

◆ String() [2/8]

unsafe System.String.String ( char *  value,
int  startIndex,
int  length 
)

Initializes a new instance of the T:System.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.

Parameters
valueA pointer to an array of Unicode characters.
startIndexThe starting position within value .
lengthThe number of characters within value to use.
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex or length is less than zero, value + startIndex cause a pointer overflow, or the current process does not have read access to all the addressed characters.
T:System.ArgumentExceptionvalue specifies an array that contains an invalid Unicode character, or value + startIndex specifies an address less than 64000.

◆ String() [3/8]

unsafe System.String.String ( sbyte *  value)

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

Parameters
valueA pointer to a null-terminated array of 8-bit signed integers. The integers are interpreted using the current system code page encoding (that is, the encoding specified by P:System.Text.Encoding.Default).
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentExceptionA new instance of T:System.String could not be initialized using value , assuming value is encoded in ANSI.
T:System.ArgumentOutOfRangeExceptionThe length of the new string to initialize, which is determined by the null termination character of value , is too large to allocate.
T:System.AccessViolationExceptionvalue specifies an invalid address.

◆ String() [4/8]

unsafe System.String.String ( sbyte *  value,
int  startIndex,
int  length 
)

Initializes a new instance of the T:System.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.

Parameters
valueA pointer to an array of 8-bit signed integers. The integers are interpreted using the current system code page encoding (that is, the encoding specified by P:System.Text.Encoding.Default).
startIndexThe starting position within value .
lengthThe number of characters within value to use.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionstartIndex or length is less than zero. -or-The address specified by value + startIndex is too large for the current platform; that is, the address calculation overflowed. -or-The length of the new string to initialize is too large to allocate.
T:System.ArgumentExceptionThe address specified by value + startIndex is less than 64K.-or- A new instance of T:System.String could not be initialized using value , assuming value is encoded in ANSI.
T:System.AccessViolationExceptionvalue , startIndex , and length collectively specify an invalid address.

◆ String() [5/8]

unsafe System.String.String ( sbyte *  value,
int  startIndex,
int  length,
Encoding  enc 
)

Initializes a new instance of the T:System.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 T:System.Text.Encoding object.

Parameters
valueA pointer to an array of 8-bit signed integers.
startIndexThe starting position within value .
lengthThe number of characters within value to use.
encAn object that specifies how the array referenced by value is encoded. If enc is null, ANSI encoding is assumed.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionstartIndex or length is less than zero. -or-The address specified by value + startIndex is too large for the current platform; that is, the address calculation overflowed. -or-The length of the new string to initialize is too large to allocate.
T:System.ArgumentExceptionThe address specified by value + startIndex is less than 64K.-or- A new instance of T:System.String could not be initialized using value , assuming value is encoded as specified by enc .
T:System.AccessViolationExceptionvalue , startIndex , and length collectively specify an invalid address.

◆ String() [6/8]

System.String.String ( char []  value,
int  startIndex,
int  length 
)

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

Parameters
valueAn array of Unicode characters.
startIndexThe starting position within value .
lengthThe number of characters within value to use.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionstartIndex or length is less than zero.-or- The sum of startIndex and length is greater than the number of elements in value .

◆ String() [7/8]

System.String.String ( char []  value)

Initializes a new instance of the T:System.String class to the value indicated by an array of Unicode characters.

Parameters
valueAn array of Unicode characters.

◆ String() [8/8]

System.String.String ( char  c,
int  count 
)

Initializes a new instance of the T:System.String class to the value indicated by a specified Unicode character repeated a specified number of times.

Parameters
cA Unicode character.
countThe number of times c occurs.
Exceptions
T:System.ArgumentOutOfRangeExceptioncount is less than zero.

Member Function Documentation

◆ Clone()

object System.String.Clone ( )

Returns a reference to this instance of T:System.String.

Returns
This instance of T:System.String.

Implements System.ICloneable.

Definition at line 2967 of file String.cs.

◆ Compare() [1/10]

static int System.String.Compare ( string  strA,
string  strB 
)
static

Compares two specified T:System.String objects and returns an integer that indicates their relative position in the sort order.

Parameters
strAThe first string to compare.
strBThe second string to compare.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two comparands.Value Condition Less than zero strA precedes strB in the sort order. Zero strA occurs in the same position as strB in the sort order. Greater than zero strA follows strB in the sort order.

Definition at line 1749 of file String.cs.

◆ Compare() [2/10]

static int System.String.Compare ( string  strA,
string  strB,
bool  ignoreCase 
)
static

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

Parameters
strAThe first string to compare.
strBThe second string to compare.
ignoreCasetrue to ignore case during the comparison; otherwise, false.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two comparands.Value Condition Less than zero strA precedes strB in the sort order. Zero strA occurs in the same position as strB in the sort order. Greater than zero strA follows strB in the sort order.

Definition at line 1764 of file String.cs.

◆ Compare() [3/10]

static int System.String.Compare ( string  strA,
string  strB,
StringComparison  comparisonType 
)
static

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

Parameters
strAThe first string to compare.
strBThe second string to compare.
comparisonTypeOne of the enumeration values that specifies the rules to use in the comparison.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two comparands.Value Condition Less than zero strA precedes strB in the sort order. Zero strA is in the same position as strB in the sort order. Greater than zero strA follows strB in the sort order.
Exceptions
T:System.ArgumentExceptioncomparisonType is not a T:System.StringComparison value.
T:System.NotSupportedExceptionT:System.StringComparison is not supported.

Definition at line 1787 of file String.cs.

◆ Compare() [4/10]

static int System.String.Compare ( string  strA,
string  strB,
CultureInfo  culture,
CompareOptions  options 
)
static

Compares two specified T:System.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.

Parameters
strAThe first string to compare.
strBThe second string to compare.
cultureThe culture that supplies culture-specific comparison information.
optionsOptions to use when performing the comparison (such as ignoring case or symbols).
Returns
A 32-bit signed integer that indicates the lexical relationship between strA and strB , as shown in the following tableValueConditionLess than zero strA precedes strB in the sort order. Zero strA occurs in the same position as strB in the sort order. Greater than zero strA follows strB in the sort order.
Exceptions
T:System.ArgumentExceptionoptions is not a T:System.Globalization.CompareOptions value.
T:System.ArgumentNullExceptionculture is null.

Definition at line 1846 of file String.cs.

◆ Compare() [5/10]

static int System.String.Compare ( string  strA,
string  strB,
bool  ignoreCase,
CultureInfo  culture 
)
static

Compares two specified T:System.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.

Parameters
strAThe first string to compare.
strBThe second string to compare.
ignoreCasetrue to ignore case during the comparison; otherwise, false.
cultureAn object that supplies culture-specific comparison information.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two comparands.Value Condition Less than zero strA precedes strB in the sort order. Zero strA occurs in the same position as strB in the sort order. Greater than zero strA follows strB in the sort order.
Exceptions
T:System.ArgumentNullExceptionculture is null.

Definition at line 1867 of file String.cs.

◆ Compare() [6/10]

static int System.String.Compare ( string  strA,
int  indexA,
string  strB,
int  indexB,
int  length 
)
static

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

Parameters
strAThe first string to use in the comparison.
indexAThe position of the substring within strA .
strBThe second string to use in the comparison.
indexBThe position of the substring within strB .
lengthThe maximum number of characters in the substrings to compare.
Returns
A 32-bit signed integer indicating the lexical relationship between the two comparands.Value Condition Less than zero The substring in strA precedes the substring in strB in the sort order. Zero The substrings occur in the same position in the sort order, or length is zero. Greater than zero The substring in strA follows the substring in strB in the sort order.
Exceptions
T:System.ArgumentOutOfRangeExceptionindexA is greater than strA .P:System.String.Length.-or- indexB is greater than strB .P:System.String.Length.-or- indexA , indexB , or length is negative. -or-Either indexA or indexB is null, and length is greater than zero.

Definition at line 1892 of file String.cs.

◆ Compare() [7/10]

static int System.String.Compare ( string  strA,
int  indexA,
string  strB,
int  indexB,
int  length,
bool  ignoreCase 
)
static

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

Parameters
strAThe first string to use in the comparison.
indexAThe position of the substring within strA .
strBThe second string to use in the comparison.
indexBThe position of the substring within strB .
lengthThe maximum number of characters in the substrings to compare.
ignoreCasetrue to ignore case during the comparison; otherwise, false.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two comparands.ValueCondition Less than zero The substring in strA precedes the substring in strB in the sort order. Zero The substrings occur in the same position in the sort order, or length is zero. Greater than zero The substring in strA follows the substring in strB in the sort order.
Exceptions
T:System.ArgumentOutOfRangeExceptionindexA is greater than strA .P:System.String.Length.-or- indexB is greater than strB .P:System.String.Length.-or- indexA , indexB , or length is negative. -or-Either indexA or indexB is null, and length is greater than zero.

Definition at line 1920 of file String.cs.

◆ Compare() [8/10]

static int System.String.Compare ( string  strA,
int  indexA,
string  strB,
int  indexB,
int  length,
bool  ignoreCase,
CultureInfo  culture 
)
static

Compares substrings of two specified T:System.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.

Parameters
strAThe first string to use in the comparison.
indexAThe position of the substring within strA .
strBThe second string to use in the comparison.
indexBThe position of the substring within strB .
lengthThe maximum number of characters in the substrings to compare.
ignoreCasetrue to ignore case during the comparison; otherwise, false.
cultureAn object that supplies culture-specific comparison information.
Returns
An integer that indicates the lexical relationship between the two comparands.Value Condition Less than zero The substring in strA precedes the substring in strB in the sort order. Zero The substrings occur in the same position in the sort order, or length is zero. Greater than zero The substring in strA follows the substring in strB in the sort order.
Exceptions
T:System.ArgumentOutOfRangeExceptionindexA is greater than strA .P:System.String.Length.-or- indexB is greater than strB .P:System.String.Length.-or- indexA , indexB , or length is negative. -or-Either strA or strB is null, and length is greater than zero.
T:System.ArgumentNullExceptionculture is null.

Definition at line 1955 of file String.cs.

◆ Compare() [9/10]

static int System.String.Compare ( string  strA,
int  indexA,
string  strB,
int  indexB,
int  length,
CultureInfo  culture,
CompareOptions  options 
)
static

Compares substrings of two specified T:System.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.

Parameters
strAThe first string to use in the comparison.
indexAThe starting position of the substring within strA .
strBThe second string to use in the comparison.
indexBThe starting position of the substring within strB .
lengthThe maximum number of characters in the substrings to compare.
cultureAn object that supplies culture-specific comparison information.
optionsOptions to use when performing the comparison (such as ignoring case or symbols).
Returns
An integer that indicates the lexical relationship between the two substrings, as shown in the following table.ValueConditionLess than zeroThe substring in strA precedes the substring in strB in the sort order.ZeroThe substrings occur in the same position in the sort order, or length is zero.Greater than zeroThe substring in strA follows the substring in strB in the sort order.
Exceptions
T:System.ArgumentExceptionoptions is not a T:System.Globalization.CompareOptions value.
T:System.ArgumentOutOfRangeExceptionindexA is greater than strA .Length.-or- indexB is greater than strB .Length.-or- indexA , indexB , or length is negative.-or-Either strA or strB is null, and length is greater than zero.
T:System.ArgumentNullExceptionculture is null.

Definition at line 1995 of file String.cs.

◆ Compare() [10/10]

static int System.String.Compare ( string  strA,
int  indexA,
string  strB,
int  indexB,
int  length,
StringComparison  comparisonType 
)
static

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

Parameters
strAThe first string to use in the comparison.
indexAThe position of the substring within strA .
strBThe second string to use in the comparison.
indexBThe position of the substring within strB .
lengthThe maximum number of characters in the substrings to compare.
comparisonTypeOne of the enumeration values that specifies the rules to use in the comparison.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two comparands.Value Condition Less than zero The substring in strA precedes the substring in strB in the sort order.Zero The substrings occur in the same position in the sort order, or the length parameter is zero. Greater than zero The substring in strA follllows the substring in strB in the sort order.
Exceptions
T:System.ArgumentOutOfRangeExceptionindexA is greater than strA .P:System.String.Length.-or- indexB is greater than strB .P:System.String.Length.-or- indexA , indexB , or length is negative. -or-Either indexA or indexB is null, and length is greater than zero.
T:System.ArgumentExceptioncomparisonType is not a T:System.StringComparison value.

Definition at line 2030 of file String.cs.

◆ CompareOrdinal() [1/2]

static int System.String.CompareOrdinal ( string  strA,
string  strB 
)
static

Compares two specified T:System.String objects by evaluating the numeric values of the corresponding T:System.Char objects in each string.

Parameters
strAThe first string to compare.
strBThe second string to compare.
Returns
An integer that indicates the lexical relationship between the two comparands.ValueCondition Less than zero strA is less than strB . Zero strA and strB are equal. Greater than zero strA is greater than strB .

Definition at line 2142 of file String.cs.

◆ CompareOrdinal() [2/2]

static int System.String.CompareOrdinal ( string  strA,
int  indexA,
string  strB,
int  indexB,
int  length 
)
static

Compares substrings of two specified T:System.String objects by evaluating the numeric values of the corresponding T:System.Char objects in each substring.

Parameters
strAThe first string to use in the comparison.
indexAThe starting index of the substring in strA .
strBThe second string to use in the comparison.
indexBThe starting index of the substring in strB .
lengthThe maximum number of characters in the substrings to compare.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two comparands.ValueConditionLess than zero The substring in strA is less than the substring in strB . Zero The substrings are equal, or length is zero. Greater than zero The substring in strA is greater than the substring in strB .
Exceptions
T:System.ArgumentOutOfRangeExceptionstrA is not null and indexA is greater than strA .P:System.String.Length.-or- strB is not null andindexB is greater than strB .P:System.String.Length.-or- indexA , indexB , or length is negative.

Definition at line 2176 of file String.cs.

◆ CompareTo() [1/2]

int System.String.CompareTo ( object  value)

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

Parameters
valueAn object that evaluates to a T:System.String.
Returns
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter.Value Condition Less than zero This instance precedes value . Zero This instance has the same position in the sort order as value . Greater than zero This instance follows value .-or- value is null.
Exceptions
T:System.ArgumentExceptionvalue is not a T:System.String.

Definition at line 2107 of file String.cs.

◆ CompareTo() [2/2]

int System.String.CompareTo ( string  strB)

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

Parameters
strBThe string to compare with this instance.
Returns
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the strB parameter.Value Condition Less than zero This instance precedes strB . Zero This instance has the same position in the sort order as strB . Greater than zero This instance follows strB .-or- strB is null.

Definition at line 2125 of file String.cs.

◆ Concat() [1/9]

static string System.String.Concat ( object  arg0)
static

Creates the string representation of a specified object.

Parameters
arg0The object to represent, or null.
Returns
The string representation of the value of arg0 , or F:System.String.Empty if arg0 is null.

Definition at line 3367 of file String.cs.

◆ Concat() [2/9]

static string System.String.Concat ( object  arg0,
object  arg1 
)
static

Concatenates the string representations of two specified objects.

Parameters
arg0The first object to concatenate.
arg1The second object to concatenate.
Returns
The concatenated string representations of the values of arg0 and arg1 .

Definition at line 3381 of file String.cs.

◆ Concat() [3/9]

static string System.String.Concat ( object  arg0,
object  arg1,
object  arg2 
)
static

Concatenates the string representations of three specified objects.

Parameters
arg0The first object to concatenate.
arg1The second object to concatenate.
arg2The third object to concatenate.
Returns
The concatenated string representations of the values of arg0 , arg1 , and arg2 .

Definition at line 3400 of file String.cs.

◆ Concat() [4/9]

static string System.String.Concat ( params object []  args)
static

Concatenates the string representations of the elements in a specified T:System.Object array.

Parameters
argsAn object array that contains the elements to concatenate.
Returns
The concatenated string representations of the values of the elements in args .
Exceptions
T:System.ArgumentNullExceptionargs is null.
T:System.OutOfMemoryExceptionOut of memory.

Definition at line 3441 of file String.cs.

◆ Concat() [5/9]

static string System.String.Concat ( IEnumerable< string >  values)
static

Concatenates the members of a constructed T:System.Collections.Generic.IEnumerable`1 collection of type T:System.String.

Parameters
valuesA collection object that implements T:System.Collections.Generic.IEnumerable`1 and whose generic type argument is T:System.String.
Returns
The concatenated strings in values , or F:System.String.Empty if values is an empty IEnumerable(Of String).
Exceptions
T:System.ArgumentNullExceptionvalues is null.

Definition at line 3505 of file String.cs.

◆ Concat() [6/9]

static string System.String.Concat ( string  str0,
string  str1 
)
static

Concatenates two specified instances of T:System.String.

Parameters
str0The first string to concatenate.
str1The second string to concatenate.
Returns
The concatenation of str0 and str1 .

Definition at line 3531 of file String.cs.

◆ Concat() [7/9]

static string System.String.Concat ( string  str0,
string  str1,
string  str2 
)
static

Concatenates three specified instances of T:System.String.

Parameters
str0The first string to concatenate.
str1The second string to concatenate.
str2The third string to concatenate.
Returns
The concatenation of str0 , str1 , and str2 .

Definition at line 3559 of file String.cs.

◆ Concat() [8/9]

static string System.String.Concat ( string  str0,
string  str1,
string  str2,
string  str3 
)
static

Concatenates four specified instances of T:System.String.

Parameters
str0The first string to concatenate.
str1The second string to concatenate.
str2The third string to concatenate.
str3The fourth string to concatenate.
Returns
The concatenation of str0 , str1 , str2 , and str3 .

Definition at line 3593 of file String.cs.

◆ Concat() [9/9]

static string System.String.Concat ( params string []  values)
static

Concatenates the elements of a specified T:System.String array.

Parameters
valuesAn array of string instances.
Returns
The concatenated elements of values .
Exceptions
T:System.ArgumentNullExceptionvalues is null.
T:System.OutOfMemoryExceptionOut of memory.

Definition at line 3644 of file String.cs.

◆ Concat< T >()

static string System.String.Concat< T > ( IEnumerable< T values)
static

Concatenates the members of an T:System.Collections.Generic.IEnumerable`1 implementation.

Parameters
valuesA collection object that implements the T:System.Collections.Generic.IEnumerable`1 interface.
Template Parameters
TThe type of the members of values .
Returns
The concatenated members in values .
Exceptions
T:System.ArgumentNullExceptionvalues is null.

Definition at line 3474 of file String.cs.

◆ Contains()

bool System.String.Contains ( string  value)

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

Parameters
valueThe string to seek.
Returns
true if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 2200 of file String.cs.

◆ Copy()

static unsafe string System.String.Copy ( string  str)
static

Creates a new instance of T:System.String with the same value as a specified T:System.String.

Parameters
strThe string to copy.
Returns
A new string with the same value as str .
Exceptions
T:System.ArgumentNullExceptionstr is null.

Definition at line 3345 of file String.cs.

◆ CopyTo()

unsafe void System.String.CopyTo ( int  sourceIndex,
char []  destination,
int  destinationIndex,
int  count 
)

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

Parameters
sourceIndexThe index of the first character in this instance to copy.
destinationAn array of Unicode characters to which characters in this instance are copied.
destinationIndexThe index in destination at which the copy operation begins.
countThe number of characters in this instance to copy to destination .
Exceptions
T:System.ArgumentNullExceptiondestination is null.
T:System.ArgumentOutOfRangeExceptionsourceIndex , destinationIndex , or count is negative -or- sourceIndex does not identify a position in the current instance. -or- destinationIndex does not identify a valid index in the destination array. -or- count is greater than the length of the substring from startIndex to the end of this instance -or- count is greater than the length of the subarray from destinationIndex to the end of the destination array.

Definition at line 694 of file String.cs.

◆ EndsWith() [1/3]

bool System.String.EndsWith ( string  value)

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

Parameters
valueThe string to compare to the substring at the end of this instance.
Returns
true if value matches the end of this instance; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 2212 of file String.cs.

◆ EndsWith() [2/3]

bool System.String.EndsWith ( string  value,
StringComparison  comparisonType 
)

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

Parameters
valueThe string to compare to the substring at the end of this instance.
comparisonTypeOne of the enumeration values that determines how this string and value are compared.
Returns
true if the value parameter matches the end of this string; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentExceptioncomparisonType is not a T:System.StringComparison value.

Definition at line 2229 of file String.cs.

◆ EndsWith() [3/3]

bool System.String.EndsWith ( string  value,
bool  ignoreCase,
CultureInfo  culture 
)

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

Parameters
valueThe string to compare to the substring at the end of this instance.
ignoreCasetrue to ignore case during the comparison; otherwise, false.
cultureCultural information that determines how this instance and value are compared. If culture is null, the current culture is used.
Returns
true if the value parameter matches the end of this string; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 2283 of file String.cs.

◆ Equals() [1/5]

override bool System.String.Equals ( object  obj)

Determines whether this instance and a specified object, which must also be a T:System.String object, have the same value.

Parameters
objThe string to compare to this instance.
Returns
true if obj is a T:System.String and its value is the same as this instance; otherwise, false. If obj is null, the method returns false.

Definition at line 476 of file String.cs.

◆ Equals() [2/5]

bool System.String.Equals ( string  value)

Determines whether this instance and another specified T:System.String object have the same value.

Parameters
valueThe string to compare to this instance.
Returns
true if the value of the value parameter is the same as the value of this instance; otherwise, false. If value is null, the method returns false.

Definition at line 504 of file String.cs.

◆ Equals() [3/5]

bool System.String.Equals ( string  value,
StringComparison  comparisonType 
)

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

Parameters
valueThe string to compare to this instance.
comparisonTypeOne of the enumeration values that specifies how the strings will be compared.
Returns
true if the value of the value parameter is the same as this string; otherwise, false.
Exceptions
T:System.ArgumentExceptioncomparisonType is not a T:System.StringComparison value.

Definition at line 534 of file String.cs.

◆ Equals() [4/5]

static bool System.String.Equals ( string  a,
string  b 
)
static

Determines whether two specified T:System.String objects have the same value.

Parameters
aThe first string to compare, or null.
bThe second string to compare, or null.
Returns
true if the value of a is the same as the value of b ; otherwise, false. If both a and b are null, the method returns true.

Definition at line 585 of file String.cs.

◆ Equals() [5/5]

static bool System.String.Equals ( string  a,
string  b,
StringComparison  comparisonType 
)
static

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

Parameters
aThe first string to compare, or null.
bThe second string to compare, or null.
comparisonTypeOne of the enumeration values that specifies the rules for the comparison.
Returns
true if the value of the a parameter is equal to the value of the b parameter; otherwise, false.
Exceptions
T:System.ArgumentExceptioncomparisonType is not a T:System.StringComparison value.

Definition at line 612 of file String.cs.

◆ Format() [1/8]

static string System.String.Format ( string  format,
object  arg0 
)
static

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

Parameters
formatA composite format string.
arg0The object to format.
Returns
A copy of format in which any format items are replaced by the string representation of arg0 .
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionThe format item in format is invalid.-or- The index of a format item is not zero.

Definition at line 3209 of file String.cs.

◆ Format() [2/8]

static string System.String.Format ( string  format,
object  arg0,
object  arg1 
)
static

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

Parameters
formatA composite format string.
arg0The first object to format.
arg1The second object to format.
Returns
A copy of format in which format items are replaced by the string representations of arg0 and arg1 .
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid.-or- The index of a format item is not zero or one.

Definition at line 3224 of file String.cs.

◆ Format() [3/8]

static string System.String.Format ( string  format,
object  arg0,
object  arg1,
object  arg2 
)
static

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

Parameters
formatA composite format string.
arg0The first object to format.
arg1The second object to format.
arg2The third object to format.
Returns
A copy of format in which the format items have been replaced by the string representations of arg0 , arg1 , and arg2 .
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid.-or- The index of a format item is less than zero, or greater than two.

Definition at line 3240 of file String.cs.

◆ Format() [4/8]

static string System.String.Format ( string  format,
params object []  args 
)
static

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

Parameters
formatA composite format string.
argsAn object array that contains zero or more objects to format.
Returns
A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args .
Exceptions
T:System.ArgumentNullExceptionformat or args is null.
T:System.FormatExceptionformat is invalid.-or- The index of a format item is less than zero, or greater than or equal to the length of the args array.

Definition at line 3254 of file String.cs.

◆ Format() [5/8]

static string System.String.Format ( IFormatProvider  provider,
string  format,
object  arg0 
)
static

Replaces the format item or items in a specified string with the string representation of the corresponding object. A parameter supplies culture-specific formatting information.

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string.
arg0The object to format.
Returns
A copy of format in which the format item or items have been replaced by the string representation of arg0 .
Exceptions
T:System.ArgumentNullExceptionformat or arg0 is null.
T:System.FormatExceptionformat is invalid.-or- The index of a format item is less than zero, or greater than or equal to one.

Definition at line 3273 of file String.cs.

◆ Format() [6/8]

static string System.String.Format ( IFormatProvider  provider,
string  format,
object  arg0,
object  arg1 
)
static

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

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string.
arg0The first object to format.
arg1The second object to format.
Returns
A copy of format in which format items are replaced by the string representations of arg0 and arg1 .
Exceptions
T:System.ArgumentNullExceptionformat , arg0 , or arg1 is null.
T:System.FormatExceptionformat is invalid.-or- The index of a format item is less than zero, or greater than or equal to two.

Definition at line 3289 of file String.cs.

◆ Format() [7/8]

static string System.String.Format ( IFormatProvider  provider,
string  format,
object  arg0,
object  arg1,
object  arg2 
)
static

Replaces the format items in a specified string with the string representation of three specified objects. An parameter supplies culture-specific formatting information.

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string.
arg0The first object to format.
arg1The second object to format.
arg2The third object to format.
Returns
A copy of format in which the format items have been replaced by the string representations of arg0 , arg1 , and arg2 .
Exceptions
T:System.ArgumentNullExceptionformat , arg0 , arg1 , or arg2 is null.
T:System.FormatExceptionformat is invalid.-or- The index of a format item is less than zero, or greater than or equal to three.

Definition at line 3306 of file String.cs.

◆ Format() [8/8]

static string System.String.Format ( IFormatProvider  provider,
string  format,
params object []  args 
)
static

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.

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string.
argsAn object array that contains zero or more objects to format.
Returns
A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args .
Exceptions
T:System.ArgumentNullExceptionformat or args is null.
T:System.FormatExceptionformat is invalid.-or- The index of a format item is less than zero, or greater than or equal to the length of the args array.

Definition at line 3321 of file String.cs.

◆ GetEnumerator()

CharEnumerator System.String.GetEnumerator ( )

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

Returns
An enumerator object.

Implements System.Collections.IEnumerable.

Definition at line 3875 of file String.cs.

◆ GetHashCode()

unsafe override int System.String.GetHashCode ( )

Returns the hash code for this string.

Returns
A 32-bit signed integer hash code.

Definition at line 839 of file String.cs.

◆ GetTypeCode()

TypeCode System.String.GetTypeCode ( )

Returns the T:System.TypeCode for class T:System.String.

Returns
The enumerated constant, F:System.TypeCode.String.

Implements System.IConvertible.

Definition at line 3697 of file String.cs.

◆ IndexOf() [1/9]

int System.String.IndexOf ( char  value)

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

Parameters
valueA Unicode character to seek.
Returns
The zero-based index position of value if that character is found, or -1 if it is not.

Definition at line 2311 of file String.cs.

◆ IndexOf() [2/9]

int System.String.IndexOf ( char  value,
int  startIndex 
)

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.

Parameters
valueA Unicode character to seek.
startIndexThe search starting position.
Returns
The zero-based index position of value from the start of the string if that character is found, or -1 if it is not.
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex is less than 0 (zero) or greater than the length of the string.

Definition at line 2323 of file String.cs.

◆ IndexOf() [3/9]

int System.String.IndexOf ( char  value,
int  startIndex,
int  count 
)

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.

Parameters
valueA Unicode character to seek.
startIndexThe search starting position.
countThe number of character positions to examine.
Returns
The zero-based index position of value from the start of the string if that character is found, or -1 if it is not.
Exceptions
T:System.ArgumentOutOfRangeExceptioncount or startIndex is negative.-or- startIndex is greater than the length of this string.-or- count is greater than the length of this string minus startIndex .

◆ IndexOf() [4/9]

int System.String.IndexOf ( string  value)

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

Parameters
valueThe string to seek.
Returns
The zero-based index position of value if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is 0.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 2389 of file String.cs.

◆ IndexOf() [5/9]

int System.String.IndexOf ( string  value,
int  startIndex 
)

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

Parameters
valueThe string to seek.
startIndexThe search starting position.
Returns
The zero-based index position of value from the start of the current instance if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is startIndex .
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionstartIndex is less than 0 (zero) or greater than the length of this string.

Definition at line 2403 of file String.cs.

◆ IndexOf() [6/9]

int System.String.IndexOf ( string  value,
int  startIndex,
int  count 
)

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.

Parameters
valueThe string to seek.
startIndexThe search starting position.
countThe number of character positions to examine.
Returns
The zero-based index position of value from the start of the current instance if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is startIndex .
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptioncount or startIndex is negative.-or- startIndex is greater than the length of this string.-or- count is greater than the length of this string minus startIndex .

Definition at line 2420 of file String.cs.

◆ IndexOf() [7/9]

int System.String.IndexOf ( string  value,
StringComparison  comparisonType 
)

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

Parameters
valueThe string to seek.
comparisonTypeOne of the enumeration values that specifies the rules for the search.
Returns
The index position of the value parameter if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is 0.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentExceptioncomparisonType is not a valid T:System.StringComparison value.

Definition at line 2442 of file String.cs.

◆ IndexOf() [8/9]

int System.String.IndexOf ( string  value,
int  startIndex,
StringComparison  comparisonType 
)

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

Parameters
valueThe string to seek.
startIndexThe search starting position.
comparisonTypeOne of the enumeration values that specifies the rules for the search.
Returns
The zero-based index position of the value parameter from the start of the current instance if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is startIndex .
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionstartIndex is less than 0 (zero) or greater than the length of this string.
T:System.ArgumentExceptioncomparisonType is not a valid T:System.StringComparison value.

Definition at line 2459 of file String.cs.

◆ IndexOf() [9/9]

int System.String.IndexOf ( string  value,
int  startIndex,
int  count,
StringComparison  comparisonType 
)

Reports the zero-based index of the first occurrence of the specified string in the current T:System.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.

Parameters
valueThe string to seek.
startIndexThe search starting position.
countThe number of character positions to examine.
comparisonTypeOne of the enumeration values that specifies the rules for the search.
Returns
The zero-based index position of the value parameter from the start of the current instance if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is startIndex .
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptioncount or startIndex is negative.-or- startIndex is greater than the length of this instance.-or- count is greater than the length of this string minus startIndex .
T:System.ArgumentExceptioncomparisonType is not a valid T:System.StringComparison value.

Definition at line 2480 of file String.cs.

◆ IndexOfAny() [1/3]

int System.String.IndexOfAny ( char []  anyOf)

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

Parameters
anyOfA Unicode character array containing one or more characters to seek.
Returns
The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.
Exceptions
T:System.ArgumentNullExceptionanyOf is null.

Definition at line 2348 of file String.cs.

◆ IndexOfAny() [2/3]

int System.String.IndexOfAny ( char []  anyOf,
int  startIndex 
)

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.

Parameters
anyOfA Unicode character array containing one or more characters to seek.
startIndexThe search starting position.
Returns
The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.
Exceptions
T:System.ArgumentNullExceptionanyOf is null.
T:System.ArgumentOutOfRangeExceptionstartIndex is negative.-or- startIndex is greater than the number of characters in this instance.

Definition at line 2363 of file String.cs.

◆ IndexOfAny() [3/3]

int System.String.IndexOfAny ( char []  anyOf,
int  startIndex,
int  count 
)

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.

Parameters
anyOfA Unicode character array containing one or more characters to seek.
startIndexThe search starting position.
countThe number of character positions to examine.
Returns
The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.
Exceptions
T:System.ArgumentNullExceptionanyOf is null.
T:System.ArgumentOutOfRangeExceptioncount or startIndex is negative.-or- count + startIndex is greater than the number of characters in this instance.

◆ Insert()

unsafe string System.String.Insert ( int  startIndex,
string  value 
)

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

Parameters
startIndexThe zero-based index position of the insertion.
valueThe string to insert.
Returns
A new string that is equivalent to this instance, but with value inserted at position startIndex .
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionstartIndex is negative or greater than the length of this instance.

Definition at line 3071 of file String.cs.

◆ Intern()

static string System.String.Intern ( string  str)
static

Retrieves the system's reference to the specified T:System.String.

Parameters
strA string to search for in the intern pool.
Returns
The system's reference to str , if it is interned; otherwise, a new reference to a string with the value of str .
Exceptions
T:System.ArgumentNullExceptionstr is null.

Definition at line 3671 of file String.cs.

◆ IsInterned()

static string System.String.IsInterned ( string  str)
static

Retrieves a reference to a specified T:System.String.

Parameters
strThe string to search for in the intern pool.
Returns
A reference to str if it is in the common language runtime intern pool; otherwise, null.
Exceptions
T:System.ArgumentNullExceptionstr is null.

Definition at line 3686 of file String.cs.

◆ IsNormalized() [1/2]

bool System.String.IsNormalized ( )

Indicates whether this string is in Unicode normalization form C.

Returns
true if this string is in normalization form C; otherwise, false.
Exceptions
T:System.ArgumentExceptionThe current instance contains invalid Unicode characters.

Definition at line 1443 of file String.cs.

◆ IsNormalized() [2/2]

bool System.String.IsNormalized ( NormalizationForm  normalizationForm)

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

Parameters
normalizationFormA Unicode normalization form.
Returns
true if this string is in the normalization form specified by the normalizationForm parameter; otherwise, false.
Exceptions
T:System.ArgumentExceptionThe current instance contains invalid Unicode characters.

Definition at line 1454 of file String.cs.

◆ IsNullOrEmpty()

static bool System.String.IsNullOrEmpty ( string  value)
static

Indicates whether the specified string is null or an F:System.String.Empty string.

Parameters
valueThe string to test.
Returns
true if the value parameter is null or an empty string (""); otherwise, false.

Definition at line 789 of file String.cs.

◆ IsNullOrWhiteSpace()

static bool System.String.IsNullOrWhiteSpace ( string  value)
static

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

Parameters
valueThe string to test.
Returns
true if the value parameter is null or F:System.String.Empty, or if value consists exclusively of white-space characters.

Definition at line 803 of file String.cs.

◆ Join() [1/4]

static string System.String.Join ( string  separator,
params string []  value 
)
static

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

Parameters
separatorThe string to use as a separator. separator is included in the returned string only if value has more than one element.
valueAn array that contains the elements to concatenate.
Returns
A string that consists of the elements in value delimited by the separator string. If value is an empty array, the method returns F:System.String.Empty.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 75 of file String.cs.

◆ Join() [2/4]

static string System.String.Join ( string  separator,
params object []  values 
)
static

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

Parameters
separatorThe string to use as a separator. separator is included in the returned string only if values has more than one element.
valuesAn array that contains the elements to concatenate.
Returns
A string that consists of the elements of values delimited by the separator string. If values is an empty array, the method returns F:System.String.Empty.
Exceptions
T:System.ArgumentNullExceptionvalues is null.

Definition at line 92 of file String.cs.

◆ Join() [3/4]

static string System.String.Join ( string  separator,
IEnumerable< string >  values 
)
static

Concatenates the members of a constructed T:System.Collections.Generic.IEnumerable`1 collection of type T:System.String, using the specified separator between each member.

Parameters
separatorThe string to use as a separator.separator is included in the returned string only if values has more than one element.
valuesA collection that contains the strings to concatenate.
Returns
A string that consists of the members of values delimited by the separator string. If values has no members, the method returns F:System.String.Empty.
Exceptions
T:System.ArgumentNullExceptionvalues is null.

Definition at line 185 of file String.cs.

◆ Join() [4/4]

static unsafe string System.String.Join ( string  separator,
string []  value,
int  startIndex,
int  count 
)
static

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

Parameters
separatorThe string to use as a separator. separator is included in the returned string only if value has more than one element.
valueAn array that contains the elements to concatenate.
startIndexThe first element in value to use.
countThe number of elements of value to use.
Returns
A string that consists of the strings in value delimited by the separator string. -or- F:System.String.Empty if count is zero, value has no elements, or separator and all the elements of value are F:System.String.Empty.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionstartIndex or count is less than 0.-or- startIndex plus count is greater than the number of elements in value .
T:System.OutOfMemoryExceptionOut of memory.

Definition at line 233 of file String.cs.

◆ Join< T >()

static string System.String.Join< T > ( string  separator,
IEnumerable< T values 
)
static

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

Parameters
separatorThe string to use as a separator.separator is included in the returned string only if values has more than one element.
valuesA collection that contains the objects to concatenate.
Template Parameters
TThe type of the members of values .
Returns
A string that consists of the members of values delimited by the separator string. If values has no members, the method returns F:System.String.Empty.
Exceptions
T:System.ArgumentNullExceptionvalues is null.

Definition at line 136 of file String.cs.

◆ LastIndexOf() [1/9]

int System.String.LastIndexOf ( char  value)

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

Parameters
valueThe Unicode character to seek.
Returns
The zero-based index position of value if that character is found, or -1 if it is not.

Definition at line 2521 of file String.cs.

◆ LastIndexOf() [2/9]

int System.String.LastIndexOf ( char  value,
int  startIndex 
)

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.

Parameters
valueThe Unicode character to seek.
startIndexThe starting position of the search. The search proceeds from startIndex toward the beginning of this instance.
Returns
The zero-based index position of value if that character is found, or -1 if it is not found or if the current instance equals F:System.String.Empty.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe current instance does not equal F:System.String.Empty, and startIndex is less than zero or greater than or equal to the length of this instance.

Definition at line 2533 of file String.cs.

◆ LastIndexOf() [3/9]

int System.String.LastIndexOf ( char  value,
int  startIndex,
int  count 
)

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.

Parameters
valueThe Unicode character to seek.
startIndexThe starting position of the search. The search proceeds from startIndex toward the beginning of this instance.
countThe number of character positions to examine.
Returns
The zero-based index position of value if that character is found, or -1 if it is not found or if the current instance equals F:System.String.Empty.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe current instance does not equal F:System.String.Empty, and startIndex is less than zero or greater than or equal to the length of this instance.-or- The current instance does not equal F:System.String.Empty, and startIndex - count + 1 is less than zero.

◆ LastIndexOf() [4/9]

int System.String.LastIndexOf ( string  value)

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

Parameters
valueThe string to seek.
Returns
The zero-based starting index position of value if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is the last index position in this instance.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 2597 of file String.cs.

◆ LastIndexOf() [5/9]

int System.String.LastIndexOf ( string  value,
int  startIndex 
)

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.

Parameters
valueThe string to seek.
startIndexThe search starting position. The search proceeds from startIndex toward the beginning of this instance.
Returns
The zero-based starting index position of value if that string is found, or -1 if it is not found or if the current instance equals F:System.String.Empty. If value is F:System.String.Empty, the return value is the smaller of startIndex and the last index position in this instance.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionThe current instance does not equal F:System.String.Empty, and startIndex is less than zero or greater than the length of the current instance. -or-The current instance equals F:System.String.Empty, and startIndex is less than -1 or greater than zero.

Definition at line 2611 of file String.cs.

◆ LastIndexOf() [6/9]

int System.String.LastIndexOf ( string  value,
int  startIndex,
int  count 
)

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.

Parameters
valueThe string to seek.
startIndexThe search starting position. The search proceeds from startIndex toward the beginning of this instance.
countThe number of character positions to examine.
Returns
The zero-based starting index position of value if that string is found, or -1 if it is not found or if the current instance equals F:System.String.Empty. If value is F:System.String.Empty, the return value is the smaller of startIndex and the last index position in this instance.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptioncount is negative.-or- The current instance does not equal F:System.String.Empty, and startIndex is negative.-or- The current instance does not equal F:System.String.Empty, and startIndex is greater than the length of this instance.-or- The current instance does not equal F:System.String.Empty, and startIndex - count + 1 specifies a position that is not within this instance. -or-The current instance equals F:System.String.Empty and start is less than -1 or greater than zero. -or-The current instance equals F:System.String.Empty and count is greater than 1.

Definition at line 2629 of file String.cs.

◆ LastIndexOf() [7/9]

int System.String.LastIndexOf ( string  value,
StringComparison  comparisonType 
)

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

Parameters
valueThe string to seek.
comparisonTypeOne of the enumeration values that specifies the rules for the search.
Returns
The zero-based starting index position of the value parameter if that string is found, or -1 if it is not. If value is F:System.String.Empty, the return value is the last index position in this instance.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentExceptioncomparisonType is not a valid T:System.StringComparison value.

Definition at line 2647 of file String.cs.

◆ LastIndexOf() [8/9]

int System.String.LastIndexOf ( string  value,
int  startIndex,
StringComparison  comparisonType 
)

Reports the zero-based index of the last occurrence of a specified string within the current T:System.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.

Parameters
valueThe string to seek.
startIndexThe search starting position. The search proceeds from startIndex toward the beginning of this instance.
comparisonTypeOne of the enumeration values that specifies the rules for the search.
Returns
The zero-based starting index position of the value parameter if that string is found, or -1 if it is not found or if the current instance equals F:System.String.Empty. If value is F:System.String.Empty, the return value is the smaller of startIndex and the last index position in this instance.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionThe current instance does not equal F:System.String.Empty, and startIndex is less than zero or greater than the length of the current instance. -or-The current instance equals F:System.String.Empty, and startIndex is less than -1 or greater than zero.
T:System.ArgumentExceptioncomparisonType is not a valid T:System.StringComparison value.

Definition at line 2664 of file String.cs.

◆ LastIndexOf() [9/9]

int System.String.LastIndexOf ( string  value,
int  startIndex,
int  count,
StringComparison  comparisonType 
)

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.

Parameters
valueThe string to seek.
startIndexThe search starting position. The search proceeds from startIndex toward the beginning of this instance.
countThe number of character positions to examine.
comparisonTypeOne of the enumeration values that specifies the rules for the search.
Returns
The zero-based starting index position of the value parameter if that string is found, or -1 if it is not found or if the current instance equals F:System.String.Empty. If value is F:System.String.Empty, the return value is the smaller of startIndex and the last index position in this instance.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptioncount is negative.-or- The current instance does not equal F:System.String.Empty, and startIndex is negative.-or- The current instance does not equal F:System.String.Empty, and startIndex is greater than the length of this instance.-or- The current instance does not equal F:System.String.Empty, and startIndex + 1 - count specifies a position that is not within this instance. -or-The current instance equals F:System.String.Empty and start is less than -1 or greater than zero. -or-The current instance equals F:System.String.Empty and count is greater than 1.
T:System.ArgumentExceptioncomparisonType is not a valid T:System.StringComparison value.

Definition at line 2686 of file String.cs.

◆ LastIndexOfAny() [1/3]

int System.String.LastIndexOfAny ( char []  anyOf)

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

Parameters
anyOfA Unicode character array containing one or more characters to seek.
Returns
The index position of the last occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.
Exceptions
T:System.ArgumentNullExceptionanyOf is null.

Definition at line 2557 of file String.cs.

◆ LastIndexOfAny() [2/3]

int System.String.LastIndexOfAny ( char []  anyOf,
int  startIndex 
)

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.

Parameters
anyOfA Unicode character array containing one or more characters to seek.
startIndexThe search starting position. The search proceeds from startIndex toward the beginning of this instance.
Returns
The index position of the last occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found or if the current instance equals F:System.String.Empty.
Exceptions
T:System.ArgumentNullExceptionanyOf is null.
T:System.ArgumentOutOfRangeExceptionThe current instance does not equal F:System.String.Empty, and startIndex specifies a position that is not within this instance.

Definition at line 2571 of file String.cs.

◆ LastIndexOfAny() [3/3]

int System.String.LastIndexOfAny ( char []  anyOf,
int  startIndex,
int  count 
)

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.

Parameters
anyOfA Unicode character array containing one or more characters to seek.
startIndexThe search starting position. The search proceeds from startIndex toward the beginning of this instance.
countThe number of character positions to examine.
Returns
The index position of the last occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found or if the current instance equals F:System.String.Empty.
Exceptions
T:System.ArgumentNullExceptionanyOf is null.
T:System.ArgumentOutOfRangeExceptionThe current instance does not equal F:System.String.Empty, and count or startIndex is negative.-or- The current instance does not equal F:System.String.Empty, and startIndex minus count + 1 is less than zero.

◆ Normalize() [1/2]

string System.String.Normalize ( )

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

Returns
A new, normalized string whose textual value is the same as this string, but whose binary representation is in normalization form C.
Exceptions
T:System.ArgumentExceptionThe current instance contains invalid Unicode characters.

Definition at line 1466 of file String.cs.

◆ Normalize() [2/2]

string System.String.Normalize ( NormalizationForm  normalizationForm)

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

Parameters
normalizationFormA Unicode normalization form.
Returns
A new string whose textual value is the same as this string, but whose binary representation is in the normalization form specified by the normalizationForm parameter.
Exceptions
T:System.ArgumentExceptionThe current instance contains invalid Unicode characters.

Definition at line 1476 of file String.cs.

◆ operator !=()

static bool System.String.operator != ( string  a,
string  b 
)
static

Determines whether two specified strings have different values.

Parameters
aThe first string to compare, or null.
bThe second string to compare, or null.
Returns
true if the value of a is different from the value of b ; otherwise, false.

Definition at line 674 of file String.cs.

◆ operator==()

static bool System.String.operator== ( string  a,
string  b 
)
static

Determines whether two specified strings have the same value.

Parameters
aThe first string to compare, or null.
bThe second string to compare, or null.
Returns
true if the value of a is the same as the value of b ; otherwise, false.

Definition at line 663 of file String.cs.

◆ PadLeft() [1/2]

string System.String.PadLeft ( int  totalWidth)

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.

Parameters
totalWidthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
Returns
A new string that is equivalent to this instance, but right-aligned and padded on the left with as many spaces as needed to create a length of totalWidth . However, if totalWidth is less than the length of this instance, the method returns a reference to the existing instance. If totalWidth is equal to the length of this instance, the method returns a new string that is identical to this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptiontotalWidth is less than zero.

Definition at line 2749 of file String.cs.

◆ PadLeft() [2/2]

string System.String.PadLeft ( int  totalWidth,
char  paddingChar 
)

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.

Parameters
totalWidthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
paddingCharA Unicode padding character.
Returns
A new string that is equivalent to this instance, but right-aligned and padded on the left with as many paddingChar characters as needed to create a length of totalWidth . However, if totalWidth is less than the length of this instance, the method returns a reference to the existing instance. If totalWidth is equal to the length of this instance, the method returns a new string that is identical to this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptiontotalWidth is less than zero.

Definition at line 2761 of file String.cs.

◆ PadRight() [1/2]

string System.String.PadRight ( int  totalWidth)

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.

Parameters
totalWidthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
Returns
A new string that is equivalent to this instance, but left-aligned and padded on the right with as many spaces as needed to create a length of totalWidth . However, if totalWidth is less than the length of this instance, the method returns a reference to the existing instance. If totalWidth is equal to the length of this instance, the method returns a new string that is identical to this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptiontotalWidth is less than zero.

Definition at line 2772 of file String.cs.

◆ PadRight() [2/2]

string System.String.PadRight ( int  totalWidth,
char  paddingChar 
)

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.

Parameters
totalWidthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
paddingCharA Unicode padding character.
Returns
A new string that is equivalent to this instance, but left-aligned and padded on the right with as many paddingChar characters as needed to create a length of totalWidth . However, if totalWidth is less than the length of this instance, the method returns a reference to the existing instance. If totalWidth is equal to the length of this instance, the method returns a new string that is identical to this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptiontotalWidth is less than zero.

Definition at line 2784 of file String.cs.

◆ Remove() [1/2]

unsafe string System.String.Remove ( int  startIndex,
int  count 
)

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

Parameters
startIndexThe zero-based position to begin deleting characters.
countThe number of characters to delete.
Returns
A new string that is equivalent to this instance except for the removed characters.
Exceptions
T:System.ArgumentOutOfRangeExceptionEither startIndex or count is less than zero.-or- startIndex plus count specify a position outside this instance.

Definition at line 3149 of file String.cs.

◆ Remove() [2/2]

string System.String.Remove ( int  startIndex)

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.

Parameters
startIndexThe zero-based position to begin deleting characters.
Returns
A new string that is equivalent to this string except for the removed characters.
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex is less than zero.-or- startIndex specifies a position that is not within this string.

Definition at line 3188 of file String.cs.

◆ Replace() [1/2]

string System.String.Replace ( char  oldChar,
char  newChar 
)

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

Parameters
oldCharThe Unicode character to be replaced.
newCharThe Unicode character to replace all occurrences of oldChar .
Returns
A string that is equivalent to this instance except that all instances of oldChar are replaced with newChar . If oldChar is not found in the current instance, the method returns the current instance unchanged.

Definition at line 3113 of file String.cs.

◆ Replace() [2/2]

string System.String.Replace ( string  oldValue,
string  newValue 
)

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

Parameters
oldValueThe string to be replaced.
newValueThe string to replace all occurrences of oldValue .
Returns
A string that is equivalent to the current string except that all instances of oldValue are replaced with newValue . If oldValue is not found in the current instance, the method returns the current instance unchanged.
Exceptions
T:System.ArgumentNullExceptionoldValue is null.
T:System.ArgumentExceptionoldValue is the empty string ("").

Definition at line 3131 of file String.cs.

◆ Split() [1/6]

string [] System.String.Split ( params char []  separator)

Splits a string into substrings that are based on the characters in an array.

Parameters
separatorA character array that delimits the substrings in this string, an empty array that contains no delimiters, or null.
Returns
An array whose elements contain the substrings from this instance that are delimited by one or more characters in separator . For more information, see the Remarks section.

Definition at line 895 of file String.cs.

◆ Split() [2/6]

string [] System.String.Split ( char []  separator,
int  count 
)

Splits a string into a maximum number of substrings based on the characters in an array. You also specify the maximum number of substrings to return.

Parameters
separatorA character array that delimits the substrings in this string, an empty array that contains no delimiters, or null.
countThe maximum number of substrings to return.
Returns
An array whose elements contain the substrings in this instance that are delimited by one or more characters in separator . For more information, see the Remarks section.
Exceptions
T:System.ArgumentOutOfRangeExceptioncount is negative.

Definition at line 907 of file String.cs.

◆ Split() [3/6]

string [] System.String.Split ( char []  separator,
StringSplitOptions  options 
)

Splits a string into substrings based on the characters in an array. You can specify whether the substrings include empty array elements.

Parameters
separatorA character array that delimits the substrings in this string, an empty array that contains no delimiters, or null.
optionsF:System.StringSplitOptions.RemoveEmptyEntries to omit empty array elements from the array returned; or F:System.StringSplitOptions.None to include empty array elements in the array returned.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more characters in separator . For more information, see the Remarks section.
Exceptions
T:System.ArgumentExceptionoptions is not one of the T:System.StringSplitOptions values.

Definition at line 921 of file String.cs.

◆ Split() [4/6]

string [] System.String.Split ( char []  separator,
int  count,
StringSplitOptions  options 
)

Splits a string into a maximum number of substrings based on the characters in an array.

Parameters
separatorA character array that delimits the substrings in this string, an empty array that contains no delimiters, or null.
countThe maximum number of substrings to return.
optionsF:System.StringSplitOptions.RemoveEmptyEntries to omit empty array elements from the array returned; or F:System.StringSplitOptions.None to include empty array elements in the array returned.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more characters in separator . For more information, see the Remarks section.
Exceptions
T:System.ArgumentOutOfRangeExceptioncount is negative.
T:System.ArgumentExceptionoptions is not one of the T:System.StringSplitOptions values.

Definition at line 938 of file String.cs.

◆ Split() [5/6]

string [] System.String.Split ( string []  separator,
StringSplitOptions  options 
)

Splits a string into substrings based on the strings in an array. You can specify whether the substrings include empty array elements.

Parameters
separatorA string array that delimits the substrings in this string, an empty array that contains no delimiters, or null.
optionsF:System.StringSplitOptions.RemoveEmptyEntries to omit empty array elements from the array returned; or F:System.StringSplitOptions.None to include empty array elements in the array returned.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more strings in separator . For more information, see the Remarks section.
Exceptions
T:System.ArgumentExceptionoptions is not one of the T:System.StringSplitOptions values.

Definition at line 984 of file String.cs.

◆ Split() [6/6]

string [] System.String.Split ( string []  separator,
int  count,
StringSplitOptions  options 
)

Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the substrings include empty array elements.

Parameters
separatorA string array that delimits the substrings in this string, an empty array that contains no delimiters, or null.
countThe maximum number of substrings to return.
optionsF:System.StringSplitOptions.RemoveEmptyEntries to omit empty array elements from the array returned; or F:System.StringSplitOptions.None to include empty array elements in the array returned.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more strings in separator . For more information, see the Remarks section.
Exceptions
T:System.ArgumentOutOfRangeExceptioncount is negative.
T:System.ArgumentExceptionoptions is not one of the T:System.StringSplitOptions values.

Definition at line 1001 of file String.cs.

◆ StartsWith() [1/3]

bool System.String.StartsWith ( string  value)

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

Parameters
valueThe string to compare.
Returns
true if value matches the beginning of this string; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 2800 of file String.cs.

◆ StartsWith() [2/3]

bool System.String.StartsWith ( string  value,
StringComparison  comparisonType 
)

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

Parameters
valueThe string to compare.
comparisonTypeOne of the enumeration values that determines how this string and value are compared.
Returns
true if this instance begins with value ; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentExceptioncomparisonType is not a T:System.StringComparison value.

Definition at line 2821 of file String.cs.

◆ StartsWith() [3/3]

bool System.String.StartsWith ( string  value,
bool  ignoreCase,
CultureInfo  culture 
)

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

Parameters
valueThe string to compare.
ignoreCasetrue to ignore case during the comparison; otherwise, false.
cultureCultural information that determines how this string and value are compared. If culture is null, the current culture is used.
Returns
true if the value parameter matches the beginning of this string; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionvalue is null.

Definition at line 2875 of file String.cs.

◆ Substring() [1/2]

string System.String.Substring ( int  startIndex)

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

Parameters
startIndexThe zero-based starting character position of a substring in this instance.
Returns
A string that is equivalent to the substring that begins at startIndex in this instance, or F:System.String.Empty if startIndex is equal to the length of this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex is less than zero or greater than the length of this instance.

Definition at line 1200 of file String.cs.

◆ Substring() [2/2]

string System.String.Substring ( int  startIndex,
int  length 
)

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

Parameters
startIndexThe zero-based starting character position of a substring in this instance.
lengthThe number of characters in the substring.
Returns
A string that is equivalent to the substring of length length that begins at startIndex in this instance, or F:System.String.Empty if startIndex is equal to the length of this instance and length is zero.
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex plus length indicates a position not within this instance.-or- startIndex or length is less than zero.

Definition at line 1214 of file String.cs.

◆ ToCharArray() [1/2]

unsafe char [] System.String.ToCharArray ( )

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

Returns
A Unicode character array whose elements are the individual characters of this instance. If this instance is an empty string, the returned array is empty and has a zero length.

Definition at line 732 of file String.cs.

◆ ToCharArray() [2/2]

unsafe char [] System.String.ToCharArray ( int  startIndex,
int  length 
)

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

Parameters
startIndexThe starting position of a substring in this instance.
lengthThe length of the substring in this instance.
Returns
A Unicode character array whose elements are the length number of characters in this instance starting from character position startIndex .
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex or length is less than zero.-or- startIndex plus length is greater than the length of this instance.

Definition at line 759 of file String.cs.

◆ ToLower() [1/2]

string System.String.ToLower ( )

Returns a copy of this string converted to lowercase.

Returns
A string in lowercase.

Definition at line 2892 of file String.cs.

◆ ToLower() [2/2]

string System.String.ToLower ( CultureInfo  culture)

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

Parameters
cultureAn object that supplies culture-specific casing rules.
Returns
The lowercase equivalent of the current string.
Exceptions
T:System.ArgumentNullExceptionculture is null.

Definition at line 2902 of file String.cs.

◆ ToLowerInvariant()

string System.String.ToLowerInvariant ( )

Returns a copy of this T:System.String object converted to lowercase using the casing rules of the invariant culture.

Returns
The lowercase equivalent of the current string.

Definition at line 2914 of file String.cs.

◆ ToString() [1/2]

override string System.String.ToString ( )

Returns this instance of T:System.String; no actual conversion is performed.

Returns
The current string.

Definition at line 2952 of file String.cs.

◆ ToString() [2/2]

string System.String.ToString ( IFormatProvider  provider)

Returns this instance of T:System.String; no actual conversion is performed.

Parameters
provider(Reserved) An object that supplies culture-specific formatting information.
Returns
The current string.

Implements System.IConvertible.

Definition at line 2960 of file String.cs.

◆ ToUpper() [1/2]

string System.String.ToUpper ( )

Returns a copy of this string converted to uppercase.

Returns
The uppercase equivalent of the current string.

Definition at line 2922 of file String.cs.

◆ ToUpper() [2/2]

string System.String.ToUpper ( CultureInfo  culture)

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

Parameters
cultureAn object that supplies culture-specific casing rules.
Returns
The uppercase equivalent of the current string.
Exceptions
T:System.ArgumentNullExceptionculture is null.

Definition at line 2932 of file String.cs.

◆ ToUpperInvariant()

string System.String.ToUpperInvariant ( )

Returns a copy of this T:System.String object converted to uppercase using the casing rules of the invariant culture.

Returns
The uppercase equivalent of the current string.

Definition at line 2944 of file String.cs.

◆ Trim() [1/2]

string System.String.Trim ( params char []  trimChars)

Removes all leading and trailing occurrences of a set of characters specified in an array from the current T:System.String object.

Parameters
trimCharsAn array of Unicode characters to remove, or null.
Returns
The string that remains after all occurrences of the characters in the trimChars parameter are removed from the start and end of the current string. If trimChars is null or an empty array, white-space characters are removed instead. If no characters can be trimmed from the current instance, the method returns the current instance unchanged.

Definition at line 1261 of file String.cs.

◆ Trim() [2/2]

string System.String.Trim ( )

Removes all leading and trailing white-space characters from the current T:System.String object.

Returns
The string that remains after all white-space characters are removed from the start and end of the current string. If no characters can be trimmed from the current instance, the method returns the current instance unchanged.

Definition at line 2980 of file String.cs.

◆ TrimEnd()

string System.String.TrimEnd ( params char []  trimChars)

Removes all trailing occurrences of a set of characters specified in an array from the current T:System.String object.

Parameters
trimCharsAn array of Unicode characters to remove, or null.
Returns
The string that remains after all occurrences of the characters in the trimChars parameter are removed from the end of the current string. If trimChars is null or an empty array, Unicode white-space characters are removed instead. If no characters can be trimmed from the current instance, the method returns the current instance unchanged.

Definition at line 1287 of file String.cs.

◆ TrimStart()

string System.String.TrimStart ( params char []  trimChars)

Removes all leading occurrences of a set of characters specified in an array from the current T:System.String object.

Parameters
trimCharsAn array of Unicode characters to remove, or null.
Returns
The string that remains after all occurrences of characters in the trimChars parameter are removed from the start of the current string. If trimChars is null or an empty array, white-space characters are removed instead.

Definition at line 1274 of file String.cs.

Member Data Documentation

◆ Empty

readonly string System.String.Empty
static

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

Definition at line 34 of file String.cs.

Property Documentation

◆ Length

int System.String.Length
get

Gets the number of characters in the current T:System.String object.

Returns
The number of characters in the current string.

Definition at line 61 of file String.cs.

◆ this[int index]

char System.String.this[int index]
get

Gets the T:System.Char object at a specified position in the current T:System.String object.

Parameters
indexA position in the current string.
Returns
The object at position index .
Exceptions
T:System.IndexOutOfRangeExceptionindex is greater than or equal to the length of this object or less than zero.

Definition at line 50 of file String.cs.


The documentation for this class was generated from the following file: