String Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Represents text as a series of Unicode characters.

Inheritance Hierarchy

System..::.Object
  System..::.String

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

Public NotInheritable Class String _
    Implements IEnumerable(Of Char), IEnumerable,  _
    IComparable, IComparable(Of String), IConvertible, IEquatable(Of String)
public sealed class String : IEnumerable<char>, 
    IEnumerable, IComparable, IComparable<string>, IConvertible, IEquatable<string>

The String type exposes the following members.

Constructors

  Name Description
String(Char*) Security Critical. Initializes a new instance of the String class to the value indicated by a specified pointer to an array of Unicode characters.
String(array<Char>[]()[]) Initializes a new instance of the String class to the value indicated by an array of Unicode characters.
String(SByte*) Security Critical. Initializes a new instance of the String class to the value indicated by a pointer to an array of 8-bit signed integers.
String(Char, Int32) Initializes a new instance of the String class to the value indicated by a specified Unicode character repeated a specified number of times.
String(Char*, Int32, Int32) Security Critical. Initializes a new instance of the String class to the value indicated by a specified pointer to an array of Unicode characters, a starting character position within that array, and a length.
String(array<Char>[]()[], Int32, Int32) Initializes a new instance of the String class to the value indicated by an array of Unicode characters, a starting character position within that array, and a length.

Top

Properties

  Name Description
Chars Gets the character at a specified character position in the current string.
Length Gets the number of characters in the current string.

Top

Methods

  Name Description
Compare(String, String) Performs a culture-sensitive comparison of two specified String objects and returns an integer that indicates their relationship to one another in the sort order.
Compare(String, String, StringComparison) Compares two specified String objects using the specified string comparison options and returns an integer that indicates their relationship to one another in the sort order.
Compare(String, String, CultureInfo, CompareOptions) Compares two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to one another in the sort order.
Compare(String, Int32, String, Int32, Int32) Performs a culture-sensitive comparison of substrings that are extracted from two specified String objects and returns an integer that indicates their relationship to one another in the sort order.
Compare(String, Int32, String, Int32, Int32, StringComparison) Compares substrings of two specified String objects using the specified string comparison options and returns an integer that indicates their relationship to one another in the sort order.
Compare(String, Int32, String, Int32, Int32, CultureInfo, CompareOptions) Compares substrings of two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to one another in the sort order.
CompareOrdinal(String, String) Compares two specified String objects by evaluating the numeric values of the corresponding Char objects in each string and returns an integer that indicates their relative position in the sort order.
CompareOrdinal(String, Int32, String, Int32, Int32) Compares substrings of two specified String objects by evaluating the numeric values of the corresponding Char objects in each substring.
CompareTo(Object) Compares this instance with a specified Object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified Object.
CompareTo(String) Compares this instance with a specified String object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified String.
Concat(Object) Creates the String representation of a specified object.
Concat(array<Object>[]()[]) Concatenates the string representations of the elements in a specified Object array.
Concat(IEnumerable<(Of <(String>)>)) Concatenates the members of a constructed IEnumerable<(Of <(T>)>) collection of type String.
Concat(array<String>[]()[]) Concatenates the elements of a specified String array.
Concat(Object, Object) Concatenates the string representations of two specified objects.
Concat(String, String) Concatenates two specified instances of String.
Concat(Object, Object, Object) Concatenates the String representations of three specified objects.
Concat(String, String, String) Concatenates three specified instances of String.
Concat(String, String, String, String) Concatenates four specified instances of String.
Concat<(Of <(T>)>)(IEnumerable<(Of <(T>)>)) Concatenates the members of an IEnumerable<(Of <(T>)>) implementation.
Contains Returns a value indicating whether the specified String object occurs within this string.
Copy Creates a new instance of String with the same value as a specified String.
CopyTo Copies a specified number of characters from a specified position in this instance to a specified position in an array of Unicode characters.
EndsWith(String) Determines whether the end of this instance matches the specified string.
EndsWith(String, StringComparison) Determines whether the end of this string matches the specified string when compared using the specified comparison option.
Equals(Object) Determines whether this instance of String and a specified object, which must also be a String object, have the same value. (Overrides Object..::.Equals(Object).)
Equals(String) Determines whether this instance and another specified String object have the same value.
Equals(String, String) Determines whether two specified String objects have the same value.
Equals(String, StringComparison) Determines whether this string and a specified String object have the same value. A parameter specifies the culture, case, and sort rules used in the comparison.
Equals(String, String, StringComparison) Determines whether two specified String objects have the same value. A parameter specifies the culture, case, and sort rules used in the comparison.
Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Format(String, Object) Replaces one or more format items in a specified string with the string representation of a specified object.
Format(String, array<Object>[]()[]) Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.
Format(IFormatProvider, String, array<Object>[]()[]) Replaces the format item in a specified string with the text equivalent of the value of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.
Format(String, Object, Object) Replaces the format item in a specified string with the string representations of two specified objects.
Format(String, Object, Object, Object) Replaces the format items in a specified string with the string representation of three specified objects.
GetHashCode Returns the hash code for this string. (Overrides Object..::.GetHashCode()()().)
GetType Gets the Type of the current instance. (Inherited from Object.)
GetTypeCode Returns the TypeCode for class String.
IndexOf(Char) Reports the zero-based index of the first occurrence of the specified Unicode character in this string.
IndexOf(String) Reports the zero-based index of the first occurrence of the specified string in this instance.
IndexOf(Char, Int32) Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character position.
IndexOf(String, Int32) Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position.
IndexOf(String, StringComparison) Reports the zero-based index of the first occurrence of the specified string in the current String object. A parameter specifies the type of search to use for the specified string.
IndexOf(Char, Int32, Int32) Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a specified character position and examines a specified number of character positions.
IndexOf(String, Int32, Int32) Reports the zero-based index of the first occurrence of the specified string this instance. The search starts at a specified character position and examines a specified number of character positions.
IndexOf(String, Int32, StringComparison) Reports the zero-based index of the first occurrence of the specified string in the current String object. Parameters specify the starting search position in the current string and the type of search to use for the specified string.
IndexOf(String, Int32, Int32, StringComparison) Reports the zero-based index of the first occurrence of the specified string in the current String object. Parameters specify the starting search position in the current string, the number of characters in the current string to search, and the type of search to use for the specified string.
IndexOfAny(array<Char>[]()[]) Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.
IndexOfAny(array<Char>[]()[], Int32) Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position.
IndexOfAny(array<Char>[]()[], Int32, Int32) Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.
Insert Returns a new string in which a specified string is inserted at a specified index position in this instance.
Intern Retrieves the system's reference to the specified String.
IsInterned Retrieves a reference to a specified String.
IsNullOrEmpty Indicates whether the specified string is nullNothingnullptra null reference (Nothing in Visual Basic) or an Empty string.
IsNullOrWhiteSpace Indicates whether a specified string is nullNothingnullptra null reference (Nothing in Visual Basic), empty, or consists only of white-space characters.
Join(String, IEnumerable<(Of <(String>)>)) Concatenates the members of a constructed IEnumerable<(Of <(T>)>) collection of type String, using the specified separator between each member.
Join(String, array<Object>[]()[]) Concatenates the elements of an object array, using the specified separator between each element.
Join(String, array<String>[]()[]) Concatenates a specified separator String between each element of a specified String array, yielding a single concatenated string.
Join(String, array<String>[]()[], Int32, Int32) Concatenates a specified separator String between each element of a specified String array, yielding a single concatenated string. Parameters specify the first array element and number of elements to use.
Join<(Of <(T>)>)(String, IEnumerable<(Of <(T>)>)) Concatenates the members of a string collection, using the specified separator between each member.
LastIndexOf(Char) Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.
LastIndexOf(String) Reports the zero-based index position of the last occurrence of a specified string within this instance.
LastIndexOf(Char, Int32) Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. The search starts at a specified character position and proceeds backward, toward the beginning of the string.
LastIndexOf(String, Int32) Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string.
LastIndexOf(String, StringComparison) Reports the zero-based index of the last occurrence of a specified string within the current String object. A parameter specifies the type of search to use for the specified string.
LastIndexOf(Char, Int32, Int32) Reports the zero-based index position of the last occurrence of the specified Unicode character in a substring within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.
LastIndexOf(String, Int32, Int32) Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.
LastIndexOf(String, Int32, StringComparison) Reports the zero-based index of the last occurrence of a specified string within the current string. The search starts at a specified character position and proceeds backward toward the beginning of the string. A parameter specifies the type of comparison to perform when searching for the specified string.
LastIndexOf(String, Int32, Int32, StringComparison) Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for the specified number of character positions. A parameter specifies the type of comparison to perform when searching for the specified string.
LastIndexOfAny(array<Char>[]()[]) Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array.
LastIndexOfAny(array<Char>[]()[], Int32) Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the string.
LastIndexOfAny(array<Char>[]()[], Int32, Int32) Reports the zero-based index position of the last occurrence in this instance of one or more Unicode characters specified in an 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.
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
PadLeft(Int32) Right-aligns the characters in this instance, padding with spaces on the left for a specified total length.
PadLeft(Int32, Char) Right-aligns the characters in this instance, padding on the left with a specified Unicode character for a specified total length.
PadRight(Int32) Returns a new string of a specified length in which the end of the string is padded with spaces or a specified Unicode character.
PadRight(Int32, Char) Left-aligns the characters in this string, padding on the right with a specified Unicode character, for a specified total length.
Remove(Int32) Deletes all the characters from this string beginning at a specified position and continuing through the last position.
Remove(Int32, Int32) Deletes a specified number of characters from this instance beginning at a specified position.
Replace(Char, Char) Returns a new string in which all occurrences of a specified Unicode character in the current string are replaced with another specified Unicode character.
Replace(String, String) Returns a new string in which all occurrences of a specified string in the current string are replaced with another specified string.
Split(array<Char>[]()[]) Returns a string array that contains the substrings in this instance that are delimited by elements of a specified Unicode character array.
Split(array<Char>[]()[], Int32) Returns a string array that contains the substrings in this instance that are delimited by elements of a specified Unicode character array. A parameter specifies the maximum number of substrings to return.
Split(array<Char>[]()[], StringSplitOptions) Returns a string array that contains the substrings in this string that are delimited by elements of a specified Unicode character array. A parameter specifies whether to return empty array elements.
Split(array<String>[]()[], StringSplitOptions) Returns a string array that contains the substrings in this string that are delimited by elements of a specified string array. A parameter specifies whether to return empty array elements.
Split(array<Char>[]()[], Int32, StringSplitOptions) Returns a string array that contains the substrings in this string that are delimited by elements of a specified Unicode character array. Parameters specify the maximum number of substrings to return and whether to return empty array elements.
Split(array<String>[]()[], Int32, StringSplitOptions) Returns a string array that contains the substrings in this string that are delimited by elements of a specified string array. Parameters specify the maximum number of substrings to return and whether to return empty array elements.
StartsWith(String) Determines whether the beginning of this instance matches the specified string.
StartsWith(String, StringComparison) Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option.
Substring(Int32) Retrieves a substring from this instance. The substring starts at a specified character position.
Substring(Int32, Int32) Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.
ToCharArray()()() Copies the characters in this instance to a Unicode character array.
ToCharArray(Int32, Int32) Copies the characters in a specified substring in this instance to a Unicode character array.
ToLower()()() Returns a copy of this string converted to lowercase, using the casing rules of the current culture.
ToLower(CultureInfo) Returns a copy of this string converted to lowercase, using the casing rules of the specified culture.
ToLowerInvariant Returns a copy of this string converted to lowercase using the casing rules of the invariant culture.
ToString()()() Returns this instance of the string; no actual conversion is performed. (Overrides Object..::.ToString()()().)
ToString(IFormatProvider) Returns this instance of the string; no actual conversion is performed.
ToUpper()()() Returns a copy of this string converted to uppercase, using the casing rules of the current culture.
ToUpper(CultureInfo) Returns a copy of this string converted to uppercase, using the casing rules of the specified culture.
ToUpperInvariant Returns a copy of this string converted to uppercase using the casing rules of the invariant culture.
Trim()()() Removes all leading and trailing white-space characters from the current string.
Trim(array<Char>[]()[]) Removes all leading and trailing occurrences of a set of characters specified in an array from the current string.
TrimEnd Removes all trailing occurrences of a set of characters specified in an array from the current string.
TrimStart Removes all leading occurrences of a set of characters specified in an array from the current string.

Top

Operators

  Name Description
Equality Determines whether two specified String objects have the same value.
Inequality Determines whether two specified String objects have different values.

Top

Extension Methods

  Name Description
Aggregate<(Of <(Char>)>)(Func<(Of <(Char, Char, Char>)>)) Overloaded. Applies an accumulator function over a sequence. (Defined by Enumerable.)
Aggregate<(Of <(Char, TAccumulate>)>)(TAccumulate, Func<(Of <(TAccumulate, Char, TAccumulate>)>)) Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. (Defined by Enumerable.)
Aggregate<(Of <(Char, TAccumulate, TResult>)>)(TAccumulate, Func<(Of <(TAccumulate, Char, TAccumulate>)>), Func<(Of <(TAccumulate, TResult>)>)) Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. (Defined by Enumerable.)
All<(Of <(Char>)>) Determines whether all elements of a sequence satisfy a condition. (Defined by Enumerable.)
Any<(Of <(Char>)>)()()() Overloaded. Determines whether a sequence contains any elements. (Defined by Enumerable.)
Any<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Determines whether any element of a sequence satisfies a condition. (Defined by Enumerable.)
AsEnumerable<(Of <(Char>)>) Returns the input typed as IEnumerable<(Of <(T>)>). (Defined by Enumerable.)
AsQueryable()()() Overloaded. Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
AsQueryable<(Of <(Char>)>)()()() Overloaded. Converts a generic IEnumerable<(Of <(T>)>) to a generic IQueryable<(Of <(T>)>). (Defined by Queryable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Decimal>)>)) Overloaded. Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Double>)>)) Overloaded. Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Int32>)>)) Overloaded. Computes the average of a sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Int64>)>)) Overloaded. Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Decimal>)>)>)>)) Overloaded. Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Double>)>)>)>)) Overloaded. Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int32>)>)>)>)) Overloaded. Computes the average of a sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int64>)>)>)>)) Overloaded. Computes the average of a sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Single>)>)>)>)) Overloaded. Computes the average of a sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Average<(Of <(Char>)>)(Func<(Of <(Char, Single>)>)) Overloaded. Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Cast<(Of <(TResult>)>) Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Concat<(Of <(Char>)>) Concatenates two sequences. (Defined by Enumerable.)
Contains<(Of <(Char>)>)(Char) Overloaded. Determines whether a sequence contains a specified element by using the default equality comparer. (Defined by Enumerable.)
Contains<(Of <(Char>)>)(Char, IEqualityComparer<(Of <(Char>)>)) Overloaded. Determines whether a sequence contains a specified element by using a specified IEqualityComparer<(Of <(T>)>). (Defined by Enumerable.)
Count<(Of <(Char>)>)()()() Overloaded. Returns the number of elements in a sequence. (Defined by Enumerable.)
Count<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns a number that represents how many elements in the specified sequence satisfy a condition. (Defined by Enumerable.)
DefaultIfEmpty<(Of <(Char>)>)()()() Overloaded. Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty. (Defined by Enumerable.)
DefaultIfEmpty<(Of <(Char>)>)(Char) Overloaded. Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. (Defined by Enumerable.)
Distinct<(Of <(Char>)>)()()() Overloaded. Returns distinct elements from a sequence by using the default equality comparer to compare values. (Defined by Enumerable.)
Distinct<(Of <(Char>)>)(IEqualityComparer<(Of <(Char>)>)) Overloaded. Returns distinct elements from a sequence by using a specified IEqualityComparer<(Of <(T>)>) to compare values. (Defined by Enumerable.)
ElementAt<(Of <(Char>)>) Returns the element at a specified index in a sequence. (Defined by Enumerable.)
ElementAtOrDefault<(Of <(Char>)>) Returns the element at a specified index in a sequence or a default value if the index is out of range. (Defined by Enumerable.)
Except<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>)) Overloaded. Produces the set difference of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
Except<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>), IEqualityComparer<(Of <(Char>)>)) Overloaded. Produces the set difference of two sequences by using the specified IEqualityComparer<(Of <(T>)>) to compare values. (Defined by Enumerable.)
First<(Of <(Char>)>)()()() Overloaded. Returns the first element of a sequence. (Defined by Enumerable.)
First<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns the first element in a sequence that satisfies a specified condition. (Defined by Enumerable.)
FirstOrDefault<(Of <(Char>)>)()()() Overloaded. Returns the first element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.)
FirstOrDefault<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>)) Overloaded. Groups the elements of a sequence according to a specified key selector function. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey, TElement>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>)) Overloaded. Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey, TResult>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(TKey, IEnumerable<(Of <(Char>)>), TResult>)>)) Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey, TElement>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey, TResult>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(TKey, IEnumerable<(Of <(Char>)>), TResult>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey, TElement, TResult>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>), Func<(Of <(TKey, IEnumerable<(Of <(TElement>)>), TResult>)>)) Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function. (Defined by Enumerable.)
GroupBy<(Of <(Char, TKey, TElement, TResult>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>), Func<(Of <(TKey, IEnumerable<(Of <(TElement>)>), TResult>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function. (Defined by Enumerable.)
GroupJoin<(Of <(Char, TInner, TKey, TResult>)>)(IEnumerable<(Of <(TInner>)>), Func<(Of <(Char, TKey>)>), Func<(Of <(TInner, TKey>)>), Func<(Of <(Char, IEnumerable<(Of <(TInner>)>), TResult>)>)) Overloaded. Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. (Defined by Enumerable.)
GroupJoin<(Of <(Char, TInner, TKey, TResult>)>)(IEnumerable<(Of <(TInner>)>), Func<(Of <(Char, TKey>)>), Func<(Of <(TInner, TKey>)>), Func<(Of <(Char, IEnumerable<(Of <(TInner>)>), TResult>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Correlates the elements of two sequences based on key equality and groups the results. A specified IEqualityComparer<(Of <(T>)>) is used to compare keys. (Defined by Enumerable.)
Intersect<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>)) Overloaded. Produces the set intersection of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
Intersect<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>), IEqualityComparer<(Of <(Char>)>)) Overloaded. Produces the set intersection of two sequences by using the specified IEqualityComparer<(Of <(T>)>) to compare values. (Defined by Enumerable.)
Join<(Of <(Char, TInner, TKey, TResult>)>)(IEnumerable<(Of <(TInner>)>), Func<(Of <(Char, TKey>)>), Func<(Of <(TInner, TKey>)>), Func<(Of <(Char, TInner, TResult>)>)) Overloaded. Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. (Defined by Enumerable.)
Join<(Of <(Char, TInner, TKey, TResult>)>)(IEnumerable<(Of <(TInner>)>), Func<(Of <(Char, TKey>)>), Func<(Of <(TInner, TKey>)>), Func<(Of <(Char, TInner, TResult>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer<(Of <(T>)>) is used to compare keys. (Defined by Enumerable.)
Last<(Of <(Char>)>)()()() Overloaded. Returns the last element of a sequence. (Defined by Enumerable.)
Last<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns the last element of a sequence that satisfies a specified condition. (Defined by Enumerable.)
LastOrDefault<(Of <(Char>)>)()()() Overloaded. Returns the last element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.)
LastOrDefault<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns the last element of a sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.)
LongCount<(Of <(Char>)>)()()() Overloaded. Returns an Int64 that represents the total number of elements in a sequence. (Defined by Enumerable.)
LongCount<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns an Int64 that represents how many elements in a sequence satisfy a condition. (Defined by Enumerable.)
Max<(Of <(Char>)>)()()() Overloaded. Returns the maximum value in a generic sequence. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Decimal>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Decimal value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Double>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Double value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Int32>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int32 value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Int64>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int64 value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Decimal>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Double>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Double value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int32>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int32 value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int64>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int64 value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Single>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Single value. (Defined by Enumerable.)
Max<(Of <(Char>)>)(Func<(Of <(Char, Single>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Single value. (Defined by Enumerable.)
Max<(Of <(Char, TResult>)>)(Func<(Of <(Char, TResult>)>)) Overloaded. Invokes a transform function on each element of a generic sequence and returns the maximum resulting value. (Defined by Enumerable.)
Min<(Of <(Char>)>)()()() Overloaded. Returns the minimum value in a generic sequence. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Decimal>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Decimal value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Double>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Double value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Int32>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int32 value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Int64>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int64 value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Decimal>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Double>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Double value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int32>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int32 value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int64>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int64 value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Single>)>)>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Single value. (Defined by Enumerable.)
Min<(Of <(Char>)>)(Func<(Of <(Char, Single>)>)) Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Single value. (Defined by Enumerable.)
Min<(Of <(Char, TResult>)>)(Func<(Of <(Char, TResult>)>)) Overloaded. Invokes a transform function on each element of a generic sequence and returns the minimum resulting value. (Defined by Enumerable.)
OfType<(Of <(TResult>)>) Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
OrderBy<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>)) Overloaded. Sorts the elements of a sequence in ascending order according to a key. (Defined by Enumerable.)
OrderBy<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>), IComparer<(Of <(TKey>)>)) Overloaded. Sorts the elements of a sequence in ascending order by using a specified comparer. (Defined by Enumerable.)
OrderByDescending<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>)) Overloaded. Sorts the elements of a sequence in descending order according to a key. (Defined by Enumerable.)
OrderByDescending<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>), IComparer<(Of <(TKey>)>)) Overloaded. Sorts the elements of a sequence in descending order by using a specified comparer. (Defined by Enumerable.)
Reverse<(Of <(Char>)>) Inverts the order of the elements in a sequence. (Defined by Enumerable.)
Select<(Of <(Char, TResult>)>)(Func<(Of <(Char, TResult>)>)) Overloaded. Projects each element of a sequence into a new form. (Defined by Enumerable.)
Select<(Of <(Char, TResult>)>)(Func<(Of <(Char, Int32, TResult>)>)) Overloaded. Projects each element of a sequence into a new form by incorporating the element's index. (Defined by Enumerable.)
SelectMany<(Of <(Char, TResult>)>)(Func<(Of <(Char, IEnumerable<(Of <(TResult>)>)>)>)) Overloaded. Projects each element of a sequence to an IEnumerable<(Of <(T>)>) and flattens the resulting sequences into one sequence. (Defined by Enumerable.)
SelectMany<(Of <(Char, TResult>)>)(Func<(Of <(Char, Int32, IEnumerable<(Of <(TResult>)>)>)>)) Overloaded. Projects each element of a sequence to an IEnumerable<(Of <(T>)>), and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. (Defined by Enumerable.)
SelectMany<(Of <(Char, TCollection, TResult>)>)(Func<(Of <(Char, IEnumerable<(Of <(TCollection>)>)>)>), Func<(Of <(Char, TCollection, TResult>)>)) Overloaded. Projects each element of a sequence to an IEnumerable<(Of <(T>)>), flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. (Defined by Enumerable.)
SelectMany<(Of <(Char, TCollection, TResult>)>)(Func<(Of <(Char, Int32, IEnumerable<(Of <(TCollection>)>)>)>), Func<(Of <(Char, TCollection, TResult>)>)) Overloaded. Projects each element of a sequence to an IEnumerable<(Of <(T>)>), flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element. (Defined by Enumerable.)
SequenceEqual<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>)) Overloaded. Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. (Defined by Enumerable.)
SequenceEqual<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>), IEqualityComparer<(Of <(Char>)>)) Overloaded. Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer<(Of <(T>)>). (Defined by Enumerable.)
Single<(Of <(Char>)>)()()() Overloaded. Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. (Defined by Enumerable.)
Single<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. (Defined by Enumerable.)
SingleOrDefault<(Of <(Char>)>)()()() Overloaded. Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by Enumerable.)
SingleOrDefault<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by Enumerable.)
Skip<(Of <(Char>)>) Bypasses a specified number of elements in a sequence and then returns the remaining elements. (Defined by Enumerable.)
SkipWhile<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. (Defined by Enumerable.)
SkipWhile<(Of <(Char>)>)(Func<(Of <(Char, Int32, Boolean>)>)) Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Decimal>)>)) Overloaded. Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Double>)>)) Overloaded. Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Int32>)>)) Overloaded. Computes the sum of the sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Int64>)>)) Overloaded. Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Decimal>)>)>)>)) Overloaded. Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Double>)>)>)>)) Overloaded. Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int32>)>)>)>)) Overloaded. Computes the sum of the sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Int64>)>)>)>)) Overloaded. Computes the sum of the sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Nullable<(Of <(Single>)>)>)>)) Overloaded. Computes the sum of the sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Sum<(Of <(Char>)>)(Func<(Of <(Char, Single>)>)) Overloaded. Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Take<(Of <(Char>)>) Returns a specified number of contiguous elements from the start of a sequence. (Defined by Enumerable.)
TakeWhile<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Returns elements from a sequence as long as a specified condition is true. (Defined by Enumerable.)
TakeWhile<(Of <(Char>)>)(Func<(Of <(Char, Int32, Boolean>)>)) Overloaded. Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. (Defined by Enumerable.)
ToArray<(Of <(Char>)>) Creates an array from a IEnumerable<(Of <(T>)>). (Defined by Enumerable.)
ToDictionary<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>)) Overloaded. Creates a Dictionary<(Of <(TKey, TValue>)>) from an IEnumerable<(Of <(T>)>) according to a specified key selector function. (Defined by Enumerable.)
ToDictionary<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Creates a Dictionary<(Of <(TKey, TValue>)>) from an IEnumerable<(Of <(T>)>) according to a specified key selector function and key comparer. (Defined by Enumerable.)
ToDictionary<(Of <(Char, TKey, TElement>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>)) Overloaded. Creates a Dictionary<(Of <(TKey, TValue>)>) from an IEnumerable<(Of <(T>)>) according to specified key selector and element selector functions. (Defined by Enumerable.)
ToDictionary<(Of <(Char, TKey, TElement>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Creates a Dictionary<(Of <(TKey, TValue>)>) from an IEnumerable<(Of <(T>)>) according to a specified key selector function, a comparer, and an element selector function. (Defined by Enumerable.)
ToList<(Of <(Char>)>) Creates a List<(Of <(T>)>) from an IEnumerable<(Of <(T>)>). (Defined by Enumerable.)
ToLookup<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>)) Overloaded. Creates a Lookup<(Of <(TKey, TElement>)>) from an IEnumerable<(Of <(T>)>) according to a specified key selector function. (Defined by Enumerable.)
ToLookup<(Of <(Char, TKey>)>)(Func<(Of <(Char, TKey>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Creates a Lookup<(Of <(TKey, TElement>)>) from an IEnumerable<(Of <(T>)>) according to a specified key selector function and key comparer. (Defined by Enumerable.)
ToLookup<(Of <(Char, TKey, TElement>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>)) Overloaded. Creates a Lookup<(Of <(TKey, TElement>)>) from an IEnumerable<(Of <(T>)>) according to specified key selector and element selector functions. (Defined by Enumerable.)
ToLookup<(Of <(Char, TKey, TElement>)>)(Func<(Of <(Char, TKey>)>), Func<(Of <(Char, TElement>)>), IEqualityComparer<(Of <(TKey>)>)) Overloaded. Creates a Lookup<(Of <(TKey, TElement>)>) from an IEnumerable<(Of <(T>)>) according to a specified key selector function, a comparer and an element selector function. (Defined by Enumerable.)
Union<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>)) Overloaded. Produces the set union of two sequences by using the default equality comparer. (Defined by Enumerable.)
Union<(Of <(Char>)>)(IEnumerable<(Of <(Char>)>), IEqualityComparer<(Of <(Char>)>)) Overloaded. Produces the set union of two sequences by using a specified IEqualityComparer<(Of <(T>)>). (Defined by Enumerable.)
Where<(Of <(Char>)>)(Func<(Of <(Char, Boolean>)>)) Overloaded. Filters a sequence of values based on a predicate. (Defined by Enumerable.)
Where<(Of <(Char>)>)(Func<(Of <(Char, Int32, Boolean>)>)) Overloaded. Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Zip<(Of <(Char, TSecond, TResult>)>) Merges two sequences by using the specified predicate function. (Defined by Enumerable.)

Top

Fields

  Name Description
Empty Represents the empty string. This field is read-only.

Top

Explicit Interface Implementations

  Name Description
IConvertible..::.ToBoolean Infrastructure. For a description of this member, see ToBoolean.
IConvertible..::.ToByte Infrastructure. For a description of this member, see ToByte.
IConvertible..::.ToChar Infrastructure. For a description of this member, see ToChar.
IConvertible..::.ToDateTime Infrastructure. For a description of this member, see ToDateTime.
IConvertible..::.ToDecimal Infrastructure. For a description of this member, see ToDecimal.
IConvertible..::.ToDouble Infrastructure. For a description of this member, see ToDouble.
IConvertible..::.ToInt16 Infrastructure. For a description of this member, see ToInt16.
IConvertible..::.ToInt32 Infrastructure. For a description of this member, see ToInt32.
IConvertible..::.ToInt64 Infrastructure. For a description of this member, see ToInt64.
IConvertible..::.ToSByte Infrastructure. For a description of this member, see ToSByte.
IConvertible..::.ToSingle Infrastructure. For a description of this member, see ToSingle.
IConvertible..::.ToType Infrastructure. For a description of this member, see ToType.
IConvertible..::.ToUInt16 Infrastructure. For a description of this member, see ToUInt16.
IConvertible..::.ToUInt32 Infrastructure. For a description of this member, see ToUInt32.
IConvertible..::.ToUInt64 Infrastructure. For a description of this member, see ToUInt64.
IEnumerable<(Of <(Char>)>)..::.GetEnumerator Returns an enumerator that iterates through the current String object.
IEnumerable..::.GetEnumerator Returns an enumerator that iterates through the current String object.

Top

Remarks

A string is a sequential collection of Unicode characters that is used to represent text. A String object is a sequential collection of System..::.Char objects that represent a string. The value of the String object is the content of the sequential collection, and that value is immutable. The maximum size of a String object in memory is 2GB, or about 1 billion characters.

A String object is immutable (read-only) because its value cannot be modified once it has been created. Methods or operators (such as the concatenation operator) that appear to modify a String object actually create a new String object that contains the modification. In situations where you need to perform repeated modifications to a string, such as concatenating one or more characters to a string in a loop, the overhead and resulting performance hit associated with creating a new string object for each operation can be costly. In this case, the mutable System.Text..::.StringBuilder class can be used to modify a string without creating a new object for each string operation.

Each Unicode character in a string is defined by a Unicode scalar value, also called a Unicode code point or the ordinal (numeric) value of the Unicode character. Each code point is encoded using UTF-16 encoding, and the numeric value of each element of the encoding is represented by a Char object.

A single Char object usually represents a single code point; that is, the numeric value of the Char equals the code point. However, a code point might require more than one encoded element. For example, a Unicode supplementary code point (a surrogate pair) is encoded with two Char objects.

Indexes

An index is the position of a Char object, not a Unicode character, in a String. An index is a zero-based, nonnegative number starting from the first position in the string, which is index position zero. Consecutive index values might not correspond to consecutive Unicode characters because a Unicode character might be encoded as more than one Char object. To work with each Unicode character instead of each Char object, use the System.Globalization..::.StringInfo class.

Ordinal vs. Culture-Sensitive Operations

Members of the String class perform either an ordinal or linguistic operation on a String object. An ordinal operation acts on the numeric value of each Char object. A linguistic operation acts on the value of the String taking into account culture-specific casing, sorting, formatting, and parsing rules. Linguistic operations execute in the context of an explicitly declared culture or the implicit current culture. For more information about the current culture, see the CultureInfo..::.CurrentCulture topic.

Casing rules determine how to change a Unicode character between one case and another; for example, from lowercase to uppercase.

Formatting rules determine how to convert a value to its string representation, while parsing rules determine how to convert a string representation to a value.

Sort rules determine the alphabetic order of Unicode characters and how two strings compare to each other. For example, the Compare method performs a linguistic comparison while the CompareOrdinal method performs an ordinal comparison. Consequently, if the current culture is U.S. English, the Compare method considers 'a' less than 'A' while the CompareOrdinal method considers 'a' greater than 'A'.

The .NET Framework supports word, string, and ordinal sort rules. A word sort performs a culture-sensitive comparison of strings in which certain nonalphanumeric Unicode characters might have special weights assigned to them. For example, the hyphen ("-") might have a very small weight assigned to it so that "coop" and "co-op" appear next to each other in a sorted list. A string sort is similar to a word sort, except that there are no special cases and all nonalphanumeric symbols come before all alphanumeric Unicode characters.

A culture-sensitive comparison is any comparison that explicitly or implicitly uses a CultureInfo object, including the invariant culture that is specified by the CultureInfo..::.InvariantCulture property. The current implicit culture is specified by the Thread..::.CurrentCulture property.

An ordinal sort compares strings based on the numeric value of each Char object in the string. An ordinal comparison is automatically case-sensitive because the lowercase and uppercase versions of a character have different code points. However, if case is not important in your application, you can specify an ordinal comparison that ignores case. This is equivalent to converting the string to uppercase using the invariant culture and then performing an ordinal comparison on the result.

For more information about word, string, and ordinal sort rules, see the System.Globalization..::.CompareOptions topic.

A culture-sensitive comparison is typically appropriate for sorting, whereas an ordinal comparison is not. An ordinal comparison is typically appropriate for determining whether two strings are equal (that is, for determining identity), whereas a culture-sensitive comparison is not.

The Remarks for comparison and search methods specify whether the method is case-sensitive and/or culture-sensitive. By definition, any string, including the empty string (""), compares as greater than a null reference, and two null references compare as equal to each other.

Security Considerations

If your application makes a security decision about a symbolic identifier such as a file name or named pipe, or persisted data such as the text-based data in an XML file, the operation should use an ordinal comparison instead of a culture-sensitive comparison. This is because a culture-sensitive comparison can yield different results depending on the culture in effect, whereas an ordinal comparison depends solely on the binary value of the compared characters.

Functionality

The String class provides members to compare String objects, return the index of a character or string within a String object, copy the value of a String object, partition a string or combine strings, modify the value of string, format numbers, dates and times, or enumeration values into a string, and normalize a string.

Strings and Embedded Nulls

In the .NET Framework, a String object can include embedded nulls, which count as a part of the string's length. However, in some languages, such as C and C++, a null character indicates the end of a string, is not considered a part of the string, and is not counted as part of the string's length. This means that the following common assumptions that C and C++ programmers or that libraries written in C or C++ might make about strings are not necessarily valid when applied to String objects:

  • The value returned by the strlen or wcslen functions does not necessarily equal String..::.Length.

  • The string created by the strcpy_s or wcscpy_s functions is not necessarily identical to the string created by the String..::.Copy method.

You should ensure that native C and C++ code that instantiates String objects do not assume that an embedded null marks the end of the string.

Implemented Interfaces

The String class implements the IComparable, IConvertible, IComparable<(Of <(T>)>), IEnumerable, IEnumerable<(Of <(T>)>), and IEquatable<(Of <(T>)>) interfaces. Use the Convert class for conversions instead of this type's explicit interface member implementation of IConvertible.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

Thread Safety

This type is thread safe.

See Also

Reference

System Namespace

IComparable

IConvertible

IEnumerable

System.Text..::.StringBuilder

CultureInfo

Other Resources

Formatting Types