blob: 35bb44d9592b7b25f8bef4c7f688f84d261fce3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
% API
# Builtins
# CString
## CString.as_text
```tomo
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:**
```tomo
assert CString("Hello").as_text() == "Hello"
```
## CString.join
```tomo
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:**
```tomo
assert CString(",").join([CString("a"), CString("b")]) == CString("a,b")
```
|