code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(46 lines)

% API

Builtins

CString

CString.as_text

CString.as_text : func(str: CString -> Text)

Convert a C string to Text.

Argument Type Description Default
str CString The C string. -

Return: The C string as a Text.

Example:

assert CString("Hello").as_text() == "Hello"

CString.join

CString.join : func(glue: CString, pieces: [CString] -> CString)

Join a list of C strings together with a separator.

Argument Type Description Default
glue CString The C joiner used to between elements. -
pieces [CString] A list of C strings to join. -

Return: A C string of the joined together bits.

Example:

assert CString(",").join([CString("a"), CString("b")]) == CString("a,b")

1 % API
3 # Builtins
5 # CString
6 ## CString.as_text
8 ```tomo
9 CString.as_text : func(str: CString -> Text)
10 ```
12 Convert a C string to Text.
14 Argument | Type | Description | Default
15 ---------|------|-------------|---------
16 str | `CString` | The C string. | -
18 **Return:** The C string as a Text.
21 **Example:**
22 ```tomo
23 assert CString("Hello").as_text() == "Hello"
25 ```
26 ## CString.join
28 ```tomo
29 CString.join : func(glue: CString, pieces: [CString] -> CString)
30 ```
32 Join a list of C strings together with a separator.
34 Argument | Type | Description | Default
35 ---------|------|-------------|---------
36 glue | `CString` | The C joiner used to between elements. | -
37 pieces | `[CString]` | A list of C strings to join. | -
39 **Return:** A C string of the joined together bits.
42 **Example:**
43 ```tomo
44 assert CString(",").join([CString("a"), CString("b")]) == CString("a,b")
46 ```