compiler/stage2_l0/src/util/strings.l0

Module util.strings

Overview Symbols grouped by source file: compiler/stage2_l0/src/util/strings.l0

Module: util.strings

Source: compiler/stage2_l0/src/util/strings.l0 Language: Dea/L0

Imports / Includes

  • std.vector
  • std.text
  • std.string
  • sys.rt

Symbols

Function us_sv_clone

func us_sv_clone(src: StringVector*) -> StringVector*

Clone a vector of strings.

Parameters:

  • src: Source vector to copy.

Returns: New vector containing the same strings in the same order.

Function us_split_char

func us_split_char(s: string, sep: byte, keep_empty: bool) -> StringVector*

Split a string on one separator byte.

Parameters:

  • s: String to split.
  • sep: Separator byte.
  • keep_empty: Whether empty fields should be preserved.

Returns: Vector of split parts.

Function us_split_chars2_non_empty

func us_split_chars2_non_empty(s: string, sep1: byte, sep2: byte) -> StringVector*

Split a string on either of two separator bytes, dropping empty fields.

Parameters:

  • s: String to split.
  • sep1: First separator byte.
  • sep2: Second separator byte.

Returns: Vector of non-empty split parts.

Function us_split_is_space_non_empty

func us_split_is_space_non_empty(s: string) -> StringVector*

Split a string on space characters, dropping empty fields.

Parameters:

  • s: String to split.

Returns: Vector of non-empty split parts.

See also:

  • std.string::is_space for the definition of space characters.

Function us_strip_utf8_bom

func us_strip_utf8_bom(s: string) -> string

Strip a leading UTF-8 BOM from a string when present.

Parameters:

  • s: String to normalize.

Returns: s without a leading BOM.

Function us_is_utf8_continuation

func us_is_utf8_continuation(c: byte) -> bool

Return whether a byte is a UTF-8 continuation byte.

Parameters:

  • c: Byte to inspect.

Returns: true for bytes in the 0x80..0xBF range.

Function us_is_valid_utf8

func us_is_valid_utf8(s: string) -> bool

Validate that a string contains only well-formed UTF-8 byte sequences.

The validator rejects overlong forms, surrogate code points, truncated sequences, and byte sequences above U+10FFFF .

Parameters:

  • s: String to validate.

Returns: true when s is well-formed UTF-8.