Skip to content
C#

System.String API Reference

C# String — an immutable sequence of UTF-16 code units, the primary text type in .NET.

By EZ4Code Team

String

Represents text as a sequence of UTF-16 code units. String is immutable and reference type.

String.Length -> int

Gets the number of characters in the current String object (UTF-16 code units).

Returns: int

String.Substring(int startIndex, int length) -> string

Retrieves a substring from this instance starting at startIndex with the specified length.

Returns: string

String.IndexOf(string value) -> int

Reports the zero-based index of the first occurrence of value, or -1 if not found.

Returns: int

String.Replace(string old, string new) -> string

Returns a new string in which all occurrences of old are replaced with new.

Returns: string

String.Split(char[] separator) -> string[]

Splits the string into substrings based on the characters in separator.

Returns: string[]

String.ToUpper() -> string

Returns a copy of this string converted to uppercase using the current culture's casing rules.

Returns: string

String.Trim() -> string

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

Returns: string

String.Concat(string a, string b) -> string

Concatenates two specified string instances.

Returns: string

More C# API References