String Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Represents text as a series of Unicode characters.

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

[<Sealed>]
[<SerializableAttribute>]
type String =  
    class
        interface IComparable
    end

The String type exposes the following members.

  NameDescription
Public methodString(array<Char>[]()[][])Initializes a new instance of the String class to the value indicated by an array of Unicode characters.
Public methodString(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.
Public methodString(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

  NameDescription
Public propertyCharsGets the Char object at a specified position in the current String object.
Public propertyLengthGets the number of characters in the current String object.
Top

  NameDescription
Public methodStatic memberCompareCompares two specified String objects and returns an integer that indicates their relative position in the sort order.
Public methodCompareTo(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.
Public methodCompareTo(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.
Public methodStatic memberConcat(Object)Creates the string representation of a specified object.
Public methodStatic memberConcat(array<Object>[]()[][])Concatenates the string representations of the elements in a specified Object array.
Public methodStatic memberConcat(array<String>[]()[][])Concatenates the elements of a specified String array.
Public methodStatic memberConcat(Object, Object)Concatenates the string representations of two specified objects.
Public methodStatic memberConcat(String, String)Concatenates two specified instances of String.
Public methodStatic memberConcat(Object, Object, Object)Concatenates the string representations of three specified objects.
Public methodStatic memberConcat(String, String, String)Concatenates three specified instances of String.
Public methodStatic memberConcat(String, String, String, String)Concatenates four specified instances of String.
Public methodEquals(Object)Determines whether this instance and a specified object, which must also be a String object, have the same value. (Overrides Object..::..Equals(Object).)
Public methodStatic memberEquals(String, String)Determines whether two specified String objects have the same value.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIndexOf(Char)Reports the zero-based index of the first occurrence of the specified Unicode character in this string.
Public methodIndexOf(String)Reports the zero-based index of the first occurrence of the specified string in this instance.
Public methodIndexOf(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.
Public methodIndexOf(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.
Public methodIndexOf(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.
Public methodIndexOf(String, Int32, 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 and examines a specified number of character positions.
Public methodIndexOfAny(array<Char>[]()[][])Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.
Public methodIndexOfAny(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.
Public methodIndexOfAny(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.
Public methodStatic memberInternRetrieves the system's reference to the specified String.
Public methodStatic memberIsInternedRetrieves a reference to a specified String.
Public methodLastIndexOf(Char)Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.
Public methodLastIndexOf(String)Reports the zero-based index position of the last occurrence of a specified string within this instance.
Public methodLastIndexOf(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.
Public methodLastIndexOf(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.
Public methodLastIndexOf(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.
Public methodLastIndexOf(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.
Public methodLastIndexOfAny(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.
Public methodLastIndexOfAny(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.
Public methodLastIndexOfAny(array<Char>[]()[][], Int32, 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 for a specified number of character positions.
Public methodSplit(array<Char>[]()[][])Returns a string array that contains the substrings in this instance that are delimited by elements of a specified Unicode character array.
Public methodSplit(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.
Public methodSubstring(Int32)Retrieves a substring from this instance. The substring starts at a specified character position.
Public methodSubstring(Int32, Int32)Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.
Public methodToCharArray()()()()Copies the characters in this instance to a Unicode character array.
Public methodToCharArray(Int32, Int32)Copies the characters in a specified substring in this instance to a Unicode character array.
Public methodToLowerReturns a copy of this string converted to lowercase.
Public methodToStringReturns this instance of String; no actual conversion is performed. (Overrides Object..::..ToString()()()().)
Public methodToUpperReturns a copy of this string converted to uppercase.
Public methodTrim()()()()Removes all leading and trailing white-space characters from the current String object.
Public methodTrim(array<Char>[]()[][])Removes all leading and trailing occurrences of a set of characters specified in an array from the current String object.
Public methodTrimEndRemoves all trailing occurrences of a set of characters specified in an array from the current String object.
Public methodTrimStartRemoves all leading occurrences of a set of characters specified in an array from the current String object.
Top

  NameDescription
Public operatorStatic memberEqualityDetermines whether two specified strings have the same value.
Public operatorStatic memberInequalityDetermines whether two specified strings have different values.
Top

  NameDescription
Public fieldStatic memberEmptyRepresents the empty string. This field is read-only.
Top

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 (that is, it is read-only).

This type is thread safe.

Show: