From 5bdf96234a388cbd3854747b0667620ebb60ccdf Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 18 Oct 2025 19:02:07 -0400 Subject: Improved CLI parsing and add CString.join() --- api/c_strings.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 api/c_strings.md (limited to 'api/c_strings.md') diff --git a/api/c_strings.md b/api/c_strings.md new file mode 100644 index 00000000..35bb44d9 --- /dev/null +++ b/api/c_strings.md @@ -0,0 +1,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") + +``` -- cgit v1.2.3