string

Description

sealed class System.string

Derived from

IEquatable<string>

Represents a Unicode string, as a sequence of UTF-16 code units.

Public / Methods

Has​Part


public method HasPart → (1)

other in : string

The other string. If empty, the method will return true. If null, the method will return false.

returns → bool

true if this string contains with other in,
false if it does not.

Checks if this string contains the given other in one.

This method uses case-sensitive comparison of ordinal UTF-16 code units.

Has​Prefix


public method HasPrefix → (1)

other in : string

The other string. If empty, the method will return true. If null, the method will return false.

returns → bool

true if this string starts with other in,
false if it does not.

Checks if this string starts with the given other in one.

This method uses case-sensitive comparison of ordinal UTF-16 code units.

Has​Suffix


public method HasSuffix → (1)

other in : string

The other string. If empty, the method will return true. If null, the method will return false.

returns → bool

true if this string ends with other in,
false if it does not.

Checks if this string ends with the given other in one.

This method uses case-sensitive comparison of ordinal UTF-16 code units.

Index​Max


public method IndexMax → (1)

other in : string

The other string. If empty, the method will return the length of this string. If null, the method will return -1.

returns → int32

Index of the first character of the last occurrence of other in in this string or -1 iff other in is not contained in this string.

Finds the last occurrence of the given other in string in this string.

This method uses case-sensitive comparison of ordinal UTF-16 code units.

Index​Min


public method IndexMin → (2)

other in : string

The other string. If empty, the method will return 0. If null, the method will return -1.

index opt : int32 = 0
returns → int32

Index of the first character of the first occurrence of other in in this string or -1 iff other in is not contained in this string.

Finds the first occurrence of the given other in string in this string.

This method uses case-sensitive comparison of ordinal UTF-16 code units.

Replace


public method Replace → (2)

in : char

The character to replace.

in : char

The replacement character.

returns → string

The resulting string.

Replaces all occurrences of in in this string with in.

Substring

2 overloads


public method Substring1 → (1)

index in : int32

[0..string.Length]
Index of the first character to extract.

returns → string

The resulting string.

Returns a substring of this string, specified by starting index.


public method Substring2 → (2)

index in : int32

[0..string.Length]
Index of the first character to extract.

length in : int32

[0..string.Length-index]
Number of characters to extract.

returns → string

The resulting string.

Returns a substring of this string, specified by starting index and length.

Trim


public method Trim → ()

returns → string

The resulting string.

Removes both leading and trailing whitespace characters from this string.

This method treats the following Unicode code points as whitespace: all of the Separator category plus the following of the OtherControl category: '\u0009', '\u000A', '\u000B', '\u000C', '\u000D', '\u0085'

Public / Attributes

Length


public attribute Length → (get)

value : int32

[>=0]
The string length, in characters.

Returns the length of the string.