Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

String

class string

Module: System
Assembly: System.Runtime.dll
Source file: String.rvn

Inheritance: Object → String
Implements: ComparableTo<String>, EquatableTo<String>, Sequence<Character>

Immutable Unicode text stored as UTF-8, with grapheme-based length and iteration.

Remarks

Development API. Object equality and hashing use canonical Unicode 17 identity; display preserves original UTF-8 bytes. Internal value copies share immutable UTF-8 text; Object conversions still allocate wrappers. Reference identity follows the shared immutable text owner, including through Object/interface conversions. Separately constructed equal text is distinct. Explicit String.Intern shares exact stored spellings within one execution; literals are not automatically interned. Construct from a Sequence&lt;Char&gt;, literals or text APIs; the parameterless scaffold constructor is not supported. String implements Sequence&lt;Char&gt;. Length and indexing count extended graphemes; Collection&lt;Char&gt;.Count is implemented explicitly and is available through the interface, not as String.Count. Text operations require non-null text; canonical equality does not perform case folding or linguistic collation.

Constructors

1 item
String(characters: Sequence<Character>) Snapshots characters into immutable Unicode text; later input mutation is independent.

Properties

4 items
Count: int Gets the number of elements. Required implementation (no default). Defined by Collection<Character>.Count · Defined by Collection<Character>.Count
IsEmpty: bool Reports whether the text contains no bytes.
Length: int Counts extended grapheme clusters.
Utf8Bytes: ReadOnlySlice<byte> Borrows immutable UTF-8 bytes. Byte offsets are independent of grapheme indexes.

Indexers

4 items
Extension member: Item[index: Index]: Character Gets an element using a directional index. Invalid bounds fault. Extension from SequenceAccess.Item
Item[index: int]: Character Reads the character at a zero-based grapheme index. Implements Sequence<Character>.Item
Extension member: Item[range: Range]: Character[] Copies a range into independent storage. Invalid bounds fault. Extension from SequenceAccess.Item
Item[range: Range]: string Copies a half-open grapheme range; invalid bounds fault.

Methods

73 items
Extension member: All(predicate: (Character) -> bool) -> bool No summary available. Extension from Operators.All
Extension member: Any(predicate: (Character) -> bool) -> bool No summary available. Extension from Operators.Any
Extension member: Any() -> bool Tests whether the source contains an element, or an element satisfying the supplied predicate. Extension from Operators.Any
Static member: Compare(left: string, right: string, comparison: StringComparison) -> int Compares non-null strings using an explicit policy; unknown modes fault.
Static member: Compare(left: string, right: string) -> int Orders canonical NFD scalar sequences; this is not linguistic collation.
Static member: CompareOrdinal(left: string, right: string) -> int Compares text in UTF-8 byte order.
Static member: CompareOrdinalIgnoreCase(left: string, right: string) -> int Uses Unicode 17 default simple folding without normalization or expansion.
CompareTo(other: string) -> int Orders canonical NFD scalar sequences, consistently with String.Compare. Implements ComparableTo<String>.CompareTo
Static member: Concat(left: object?, right: object?) -> string Concatenates textual representations; null contributes an empty string.
Static member: Concat(left: string, right: string) -> string Concatenates two text values.
Extension member: Concat(second: Iterable<Character>) -> Iterable<Character> Enumerates the first source followed by the second source. Extension from Operators.Concat
Contains(substring: string, comparison: StringComparison) -> bool Tests whether text contains the supplied text using an explicit policy.
Contains(substring: string) -> bool Tests whether text contains the supplied text by canonical whole-grapheme matching.
ContainsOrdinal(substring: string) -> bool Tests for an exact substring.
Extension member: Count(predicate: (Character) -> bool) -> int No summary available. Extension from Operators.Count
Extension member: Count() -> int Counts source elements, optionally restricted by the supplied predicate. Extension from Operators.Count
EndsWith(suffix: string, comparison: StringComparison) -> bool Tests whether text ends with the supplied text using an explicit policy.
EndsWith(suffix: string) -> bool Tests whether text ends with the supplied text by canonical whole-grapheme matching.
EndsWithOrdinal(suffix: string) -> bool Tests for an exact text suffix.
Equals(other: string, comparison: StringComparison) -> bool Compares non-null text using the specified policy; unknown modes fault.
Equals(other: string) -> bool Tests Unicode canonical equivalence without changing either string. Implements EquatableTo<String>.Equals
Equals(other: object?) -> bool Compares text by Unicode canonical equivalence, preserving original UTF-8 bytes. Overrides Object.Equals
Extension member: Filter(predicate: (Character) -> bool) -> Iterable<Character> No summary available. Extension from Operators.Filter
Extension member: First(predicate: (Character) -> bool) -> Optional<Character> No summary available. Extension from Operators.First
Extension member: First() -> Optional<Character> Returns the first source element matching the optional predicate, or None when none exists. Extension from Operators.First
Extension member: FlatMap<U>(selector: (Character) -> Iterable<U>) -> Iterable<U> No summary available. Extension from Operators.FlatMap
Extension member: Fold<U>(seed: U, accumulator: (U, Character) -> U) -> U No summary available. Extension from Operators.Fold
Static member: Format(culture: Culture, format: string, arg0: object?, arg1: object?, arg2: object?) -> string Formats indexed arguments with escaped braces and optional grapheme alignment. culture: Supported culture supplied to every Formattable argument. format: Composite text using {inde…
Static member: Format(culture: Culture, format: string, arg0: object?, arg1: object?) -> string Formats indexed arguments with escaped braces and optional grapheme alignment. culture: Supported culture supplied to every Formattable argument. format: Composite text using {inde…
Static member: Format(culture: Culture, format: string, arg0: object?) -> string Formats indexed arguments with escaped braces and optional grapheme alignment. culture: Supported culture supplied to every Formattable argument. format: Composite text using {inde…
Static member: Format(culture: Culture, format: string, arguments: ...object?[]) -> string Formats indexed arguments with escaped braces and optional grapheme alignment. culture: Supported culture supplied to every Formattable argument. format: Composite text using {inde…
Static member: Format(format: string, arg0: object?, arg1: object?, arg2: object?) -> string Formats indexed arguments with escaped braces and optional grapheme alignment.
Static member: Format(format: string, arg0: object?, arg1: object?) -> string Formats indexed arguments with escaped braces and optional grapheme alignment.
Static member: Format(format: string, arg0: object?) -> string Formats indexed arguments with escaped braces and optional grapheme alignment.
Static member: Format(format: string, arguments: ...object?[]) -> string Formats indexed arguments with escaped braces and optional grapheme alignment.
Get(index: Index) -> Optional<Character> Returns a grapheme at a directional index, or None when outside the text.
Get(index: int) -> Optional<Character> Returns a grapheme, or None when index is outside the text.
Extension member: Get(index: Index) -> Optional<Character> Resolves a directional index against Count, returning None for invalid bounds. Extension from SequenceAccess.Get
Extension member: Get(index: int) -> Optional<Character> Returns the indexed element, or None for invalid bounds. Does not provide a concurrent snapshot. Extension from SequenceAccess.Get
GetHashCode() -> int Hashes canonical text identity without normalizing stored bytes. Overrides Object.GetHashCode
GetIterator() -> Iterator<Character> Creates an iterator over Char graphemes. Implements Iterable<Character>.GetIterator
GetScalars() -> Sequence<uint> Creates a sequence of Unicode scalar values.
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
GetUtf8ByteCount() -> int Legacy byte-oriented API; byte counting belongs to explicit encoding.
Static member: Intern(text: string) -> string Returns the canonical reference for exact text within the current execution.
Static member: IsNullOrEmpty(text: string?) -> bool Returns true for null or empty text without creating a string.
Static member: IsNullOrWhiteSpace(text: string?) -> bool Returns true for null, empty or entirely Unicode 17 White_Space text. Scans borrowed UTF-8 without trimming or creating temporary arrays.
Static member: Join(separator: string, values: string[]) -> string Joins initialized non-null strings, inserting separator between every pair. Empty input produces an empty string; size overflow faults before allocation.
Extension member: Last(predicate: (Character) -> bool) -> Optional<Character> No summary available. Extension from Operators.Last
Extension member: Last() -> Optional<Character> Returns the last source element matching the optional predicate, or None when none exists. Extension from Operators.Last
Extension member: Map<U>(selector: (Character) -> U) -> Iterable<U> No summary available. Extension from Operators.Map
Extension member: OfType<U>() -> Iterable<U> Lazily retains non-null elements compatible with the requested result type, preserving order. Extension from Operators.OfType
Replace(oldValue: string, newValue: string) -> string Replaces exact, non-overlapping matches without modifying this string. Empty replacement deletes matches; empty search faults with RuntimeError. Arguments must be non-null. Matchin…
ReplaceLineEndings() -> string Replaces Unicode newline sequences with LF, independently of the host OS.
ReplaceLineEndings(replacementText: string) -> string Replaces CRLF, CR, LF, FF, NEL, LS and PS; empty replacement deletes them. Unchanged text reuses its owner. Not for protocol framing or validation.
Extension member: Single(predicate: (Character) -> bool) -> Result<Character, SingleError> No summary available. Extension from Operators.Single
Extension member: Single() -> Result<Character, SingleError> Returns the sole matching element, or SingleError.Empty or SingleError.Multiple for a cardinality mismatch. Extension from Operators.Single
Extension member: Skip(count: int) -> Iterable<Character> Returns an iterable that skips the requested number of leading elements. Extension from Operators.Skip
Slice(range: Range) -> Result<string, InvalidRangeError> Copies a grapheme range, or returns InvalidRangeError for invalid bounds.
Extension member: Slice(range: Range) -> Result<Character[], InvalidRangeError> Copies a half-open range in enumeration order, or returns InvalidRangeError for invalid bounds. Uses one iterator and does not require constant-time indexed access. No concurrent s… Extension from SequenceAccess.Slice
SliceUtf8(byteStart: int, byteLength: int) -> Result<string, Utf8SliceError> Legacy byte-oriented API; byte slicing belongs to explicit encoding and buffers.
StartsWith(prefix: string, comparison: StringComparison) -> bool Tests whether text starts with the supplied text using an explicit policy.
StartsWith(prefix: string) -> bool Tests whether text starts with the supplied text by canonical whole-grapheme matching.
StartsWithOrdinal(prefix: string) -> bool Tests for an exact text prefix.
Extension member: Take(count: int) -> Iterable<Character> Returns an iterable containing at most the requested number of leading elements. Extension from Operators.Take
Extension member: ToList() -> ArrayList<Character> Materializes the source into a new ArrayList in enumeration order. Extension from Operators.ToList
ToLowerInvariant() -> string Unicode 17 full default lowercase, including final sigma context.
Extension member: ToMap<K, V>(keySelector: (Character) -> K, valueSelector: (Character) -> V, comparer: EqualityComparer<K>) -> HashMap<K, V> Materializes selected keys and values into a new map. Extension from Operators.ToMap
ToString() -> string Returns this string without copying or changing its UTF-8 storage. Overrides Object.ToString
ToUpperInvariant() -> string Unicode 17 full default uppercase; no locale tailoring or normalization.
Trim() -> string Removes leading and trailing Unicode 17 White_Space scalars. Preserves retained UTF-8 bytes; combining marks are not whitespace.
TrimEnd() -> string Removes trailing Unicode 17 White_Space scalars, preserving retained bytes.
TrimStart() -> string Removes leading Unicode 17 White_Space scalars, preserving retained bytes.

Operators

2 items
Static member: operator ==(left: string, right: string) -> bool Compares exact text contents.
Static member: operator !=(left: string, right: string) -> bool Compares text contents for inequality.