class · System

String<T>

public class System.String<T> : System.Any, System.IHashable<System.String<T>>, System.IComparable<System.String<T>>, System.IToString
Tipo
class
Espacio de nombres
System
Ensamblado
System.Core
Acceso
public, final
Archivo fuente
String.ant

Parámetros de tipo

NombreRestricciones
Tuno de u8, u16, u32

Herencia

Clases base
Any String<T>
Interfaces
IHashable<TSelf> IComparable<TSelf> IToString

Constructores

constructor String(length: i32)
#

A string of length zero units, filled by the method that made it.

constructor String(codeUnits: T[])
#

A string of a copy of the code units.

constructor String(codeUnits: T[], start: i32, count: i32)
#

A string of a copy of count code units of codeUnits from start.

Propiedades

property Length: i32
#

read-only

How many code units (bytes in a str).

property IsEmpty: bool
#

read-only

Métodos

method At(index: i32) -> T
#

The code unit at index.

method Equals(other: System.String<T>) -> bool
#

The same code units as other.

method Hash() -> u64
#

override

FNV-1a over the code units (computed once: strings do not change).

method CompareTo(other: System.String<T>) -> i32
#

Code unit order: -1, 0 or 1 (in UTF-8 and UTF-32 that is code point order).

method ToString() -> System.String<u8>
#

override

The text in UTF-8.

method Substring(start: i32) -> System.String<T>
#

The text from start to the end.

method Substring(start: i32, length: i32) -> System.String<T>
#

length code units from start.

method IndexOf(unit: T) -> i32
#

Where unit first appears, or -1.

method IndexOf(part: System.String<T>) -> i32
#

Where part first appears, or -1.

method Contains(part: System.String<T>) -> bool
#
method StartsWith(prefix: System.String<T>) -> bool
#
method EndsWith(suffix: System.String<T>) -> bool
#
method ToUpper() -> System.String<T>
#

ASCII letters in upper case.

method ToLower() -> System.String<T>
#

ASCII letters in lower case.

method Trim() -> System.String<T>
#

Without the spaces, tabs and line breaks at both ends.

method Split(separator: T) -> System.List<System.String<T>>
#

The pieces between each separator.

method Replace(old: System.String<T>, replacement: System.String<T>) -> System.String<T>
#

Every old replaced by replacement.

static method Concat(a: System.String<T>, b: System.String<T>) -> System.String<T>
#

static

a followed by b (what a + b does).

static method Join(separator: System.String<T>, pieces: System.List<System.String<T>>) -> System.String<T>
#

static

The pieces with separator between them.

method LastIndexOf(unit: T) -> i32
#

Where unit last appears, or -1.

method PadLeft(width: i32) -> System.String<T>
#

At least width units: spaces (or pad) before the text.

method PadLeft(width: i32, pad: T) -> System.String<T>
#
method PadRight(width: i32) -> System.String<T>
#

At least width units: spaces (or pad) after the text.

method PadRight(width: i32, pad: T) -> System.String<T>
#
method Repeat(times: i32) -> System.String<T>
#

The text times times.

method Insert(index: i32, text: System.String<T>) -> System.String<T>
#

text put in at index.

method Remove(start: i32, count: i32) -> System.String<T>
#

Without count units from start.

method ToCharArray() -> T[]
#

A copy of the code units.

method CopyTo(start: i32, target: T[], at: i32, count: i32) -> void
#

count code units from start into target at at.

method Count(unit: T) -> i32
#

How many times unit appears.

method Split(separator: System.String<T>) -> System.List<System.String<T>>
#

The pieces between each separator (a string).

method Lines() -> System.List<System.String<T>>
#

The lines of the text (split at line feeds; a carriage return before one is dropped).

static method FromUnits(codeUnits: T[]) -> System.String<T>
#

static

A string of a copy of codeUnits.

static method IsNullOrEmpty(text: System.String<T>?) -> bool
#

static

static method Compare(a: System.String<T>, b: System.String<T>) -> i32
#

static

Ordinal order: -1, 0 or 1.

method Iterator() -> System.StringIterator<T>
#

loop (T unit in text).

method Units() -> T[]
#

A copy of the code units (the string keeps its own, in place).

method CodePoints() -> u32[]
#

The Unicode code points (malformed sequences become U+FFFD).

method CodePointCount() -> i32
#

How many code points the text has.

method ToUtf8() -> System.String<u8>
#

The text in UTF-8 (str).

method ToUtf16() -> System.String<u16>
#

The text in UTF-16.

method ToUtf32() -> System.String<u32>
#

The text in UTF-32 (one unit per code point).

Miembros privados e internos (10)

static constant Short: i32
#

private

Up to this many units, a loop copies or compares faster than a call into the runtime.

field hash: u64
#

private

The hash, once computed (0: not yet).

field units: T[]
#

private

The code units, kept in the object itself (one allocation per string).

static method Move(to: System.String<T>, offset: i32, from: System.String<T>, at: i32, count: i32) -> void
#

private static

count units from from[at] into to[offset] (the ranges already checked): one copy in memory.

static method MoveIn(to: System.String<T>, offset: i32, from: T[], at: i32, count: i32) -> void
#

private static

count units from the array from[at] into to[offset] (the ranges already checked).

method MatchesAt(start: i32, part: System.String<T>) -> bool
#

private

Whether part is at start (the range already checked): a plain loop, small enough to inline where it is asked at every position.

static method Decimal(magnitude: u64, negative: bool) -> System.String<u8>
#

internal static

The decimal digits of magnitude, after a '-' when negative, written straight into a new string (what the integers' ToString gives: no array of digits first).

static method IsSpace(unit: T) -> bool
#

private static

static method Empty() -> System.String<T>
#

private static

method Slice(start: i32, length: i32) -> System.String<T>
#

private

length units from start, the range already checked.

Miembros heredados (3)

Código fuente

String<T> en Larva HIR, descompilado a partir de su Larva HIR.

System.String.hir
public class System.String<T> : System.Any, System.IHashable<System.String<T>>, System.IComparable<System.String<T>>, System.IToString
{
    // Up to this many units, a loop copies or compares faster than a call into the runtime.
    static constant Short: i32
    // The hash, once computed (0: not yet).
    field hash: u64
    // The code units, kept in the object itself (one allocation per string).
    field units: T[]
    // A string of `length` zero units, filled by the method that made it.
    constructor String(length: i32)
    // `count` units from `from[at]` into `to[offset]` (the ranges already checked): one copy in memory.
    static method Move(to: System.String<T>, offset: i32, from: System.String<T>, at: i32, count: i32) -> void
    // `count` units from the array `from[at]` into `to[offset]` (the ranges already checked).
    static method MoveIn(to: System.String<T>, offset: i32, from: T[], at: i32, count: i32) -> void
    // Whether `part` is at `start` (the range already checked): a plain loop, small enough to inline where it is asked at every position.
    method MatchesAt(start: i32, part: System.String<T>) -> bool
    // The decimal digits of `magnitude`, after a '-' when `negative`, written straight into a new string (what the
    // integers' ToString gives: no array of digits first).
    static method Decimal(magnitude: u64, negative: bool) -> System.String<u8>
    static method IsSpace(unit: T) -> bool
    static method Empty() -> System.String<T>
    // `length` units from `start`, the range already checked.
    method Slice(start: i32, length: i32) -> System.String<T>
    // A string of a copy of the code units.
    constructor String(codeUnits: T[])
    // A string of a copy of `count` code units of `codeUnits` from `start`.
    constructor String(codeUnits: T[], start: i32, count: i32)
    // The code unit at `index`.
    method At(index: i32) -> T
    // The same code units as `other`.
    method Equals(other: System.String<T>) -> bool
    // FNV-1a over the code units (computed once: strings do not change).
    method Hash() -> u64
    // Code unit order: -1, 0 or 1 (in UTF-8 and UTF-32 that is code point order).
    method CompareTo(other: System.String<T>) -> i32
    // The text in UTF-8.
    method ToString() -> System.String<u8>
    // The text from `start` to the end.
    method Substring(start: i32) -> System.String<T>
    // `length` code units from `start`.
    method Substring(start: i32, length: i32) -> System.String<T>
    // Where `unit` first appears, or -1.
    method IndexOf(unit: T) -> i32
    // Where `part` first appears, or -1.
    method IndexOf(part: System.String<T>) -> i32
    method Contains(part: System.String<T>) -> bool
    method StartsWith(prefix: System.String<T>) -> bool
    method EndsWith(suffix: System.String<T>) -> bool
    // ASCII letters in upper case.
    method ToUpper() -> System.String<T>
    // ASCII letters in lower case.
    method ToLower() -> System.String<T>
    // Without the spaces, tabs and line breaks at both ends.
    method Trim() -> System.String<T>
    // The pieces between each `separator`.
    method Split(separator: T) -> System.List<System.String<T>>
    // Every `old` replaced by `replacement`.
    method Replace(old: System.String<T>, replacement: System.String<T>) -> System.String<T>
    // `a` followed by `b` (what `a + b` does).
    static method Concat(a: System.String<T>, b: System.String<T>) -> System.String<T>
    // The pieces with `separator` between them.
    static method Join(separator: System.String<T>, pieces: System.List<System.String<T>>) -> System.String<T>
    // Where `unit` last appears, or -1.
    method LastIndexOf(unit: T) -> i32
    // At least `width` units: spaces (or `pad`) before the text.
    method PadLeft(width: i32) -> System.String<T>
    method PadLeft(width: i32, pad: T) -> System.String<T>
    // At least `width` units: spaces (or `pad`) after the text.
    method PadRight(width: i32) -> System.String<T>
    method PadRight(width: i32, pad: T) -> System.String<T>
    // The text `times` times.
    method Repeat(times: i32) -> System.String<T>
    // `text` put in at `index`.
    method Insert(index: i32, text: System.String<T>) -> System.String<T>
    // Without `count` units from `start`.
    method Remove(start: i32, count: i32) -> System.String<T>
    // A copy of the code units.
    method ToCharArray() -> T[]
    // `count` code units from `start` into `target` at `at`.
    method CopyTo(start: i32, target: T[], at: i32, count: i32) -> void
    // How many times `unit` appears.
    method Count(unit: T) -> i32
    // The pieces between each `separator` (a string).
    method Split(separator: System.String<T>) -> System.List<System.String<T>>
    // The lines of the text (split at line feeds; a carriage return before one is dropped).
    method Lines() -> System.List<System.String<T>>
    // A string of a copy of `codeUnits`.
    static method FromUnits(codeUnits: T[]) -> System.String<T>
    static method IsNullOrEmpty(text: System.String<T>?) -> bool
    // Ordinal order: -1, 0 or 1.
    static method Compare(a: System.String<T>, b: System.String<T>) -> i32
    // `loop (T unit in text)`.
    method Iterator() -> System.StringIterator<T>
    // A copy of the code units (the string keeps its own, in place).
    method Units() -> T[]
    // The Unicode code points (malformed sequences become U+FFFD).
    method CodePoints() -> u32[]
    // How many code points the text has.
    method CodePointCount() -> i32
    // The text in UTF-8 (`str`).
    method ToUtf8() -> System.String<u8>
    // The text in UTF-16.
    method ToUtf16() -> System.String<u16>
    // The text in UTF-32 (one unit per code point).
    method ToUtf32() -> System.String<u32>
    // How many code units (bytes in a str).
    property Length: i32
    property IsEmpty: bool
}
Esc