No matching definitions.

tur/str-build-string

stdlib/str-build-string.tur

owned String siblings for the cstr builders.

Since: v2 (string-owned-builders-and-optional-accessors-plan, Part 1)

defn

str-concat-string

(str-concat-string [a : cstr b : cstr] :)

concatenate two cstrs into a fresh owned String.

afirst cstr (NUL-terminated)
bsecond cstr (NUL-terminated)

A fresh owned String holding a followed by b.

(string/to-cstr (str-concat-string "Hello, " "world"))  ; => "Hello, world"

Since: v2

defn

cstr-sub-string

(cstr-sub-string [s : cstr start : int end : int] :)

substring [start, end) of a cstr, as a fresh owned String.

sNUL-terminated cstr
startzero-based start byte index (clamped into [0, len])
endexclusive end byte index (clamped into [start, len])

A fresh owned String holding the bytes of s in [start, end).

(string/to-cstr (cstr-sub-string "hello" 1 4))  ; => "ell"

Since: v2