No matching definitions.

tur/str-build

stdlib/str-build.tur

minimal cstr-building primitives (str-concat, int->str).

Since: interp-string-natives-and-range-show-plan (Phase 1)

defn

str-concat

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

concatenate two NUL-terminated strings into a new heap buffer.

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

A newly heap-allocated :cstr containing the bytes of a followed by b, NUL-terminated. The caller is responsible for freeing the returned pointer.

(str-concat "Hello, " "world")  ; => "Hello, world"

Since: Phase B1

defn

int->str

(int->str [v : int] :)

format an int64 as a decimal :cstr.

vthe integer to render

A freshly heap-allocated NUL-terminated :cstr containing the decimal digits of v (with a leading '-' for negatives). Caller owns the buffer.

(int->str 42)   ; => "42"
  (int->str -7)   ; => "-7"

Since: interp-string-natives-and-range-show-plan (Phase 1)