New v0.1.0

Source
Creates an empty string.

Package: Text

Signature

func New() -> String;

Returns

An empty String. It owns no block, so this allocates nothing, and every method treats it as a string of length zero rather than as a missing value: Length is 0, IsEmpty is true, Data is null, and Free is a no-op.

It is also what the transformations return when there is nothing to give back — Substring past the end, Trim of nothing but whitespace, Repeat zero times.

Example

import Text::String;

func Main() -> int {
    var empty = String::New();
    empty.IsEmpty(); // true
    empty.Length();  // 0
    empty.Free();    // safe, and not required
    return 0;
}

See also

  • String — the string type
  • From — create a string that holds bytes
  • IsEmpty — test for the empty string