diff options
| author | Tyge Løvset <[email protected]> | 2022-12-23 23:55:10 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-12-23 23:55:10 +0100 |
| commit | d623c6c85071b9af5d607bb5d9aceceaea05220a (patch) | |
| tree | f20fc3714f86e1553d1103bed6dc8efefcbd9d6b /docs/cstr_api.md | |
| parent | 5f57d597cd27aef55adbcb3b452973b0c6e33667 (diff) | |
| download | STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.tar.gz STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.zip | |
Experimental uppercase macros.
Diffstat (limited to 'docs/cstr_api.md')
| -rw-r--r-- | docs/cstr_api.md | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/docs/cstr_api.md b/docs/cstr_api.md index 0f9589d9..3857633a 100644 --- a/docs/cstr_api.md +++ b/docs/cstr_api.md @@ -160,30 +160,30 @@ char* cstrnstrn(const char* str, const char* search, size_t slen, size_t #include <stc/cstr.h> int main() { - cstr s0 = cstr_lit("Initialization without using strlen()."); - printf("%s\nLength: %" c_ZU "\n\n", cstr_str(&s0), cstr_size(&s0)); + c_AUTO (cstr, s0, s1, full_path) { + s0 = cstr_lit("Initialization without using strlen()."); + printf("%s\nLength: %" c_ZU "\n\n", cstr_str(&s0), cstr_size(&s0)); - cstr s1 = cstr_lit("one-nine-three-seven-five."); - printf("%s\n", cstr_str(&s1)); + s1 = cstr_lit("one-nine-three-seven-five."); + printf("%s\n", cstr_str(&s1)); - cstr_insert(&s1, 3, "-two"); - printf("%s\n", cstr_str(&s1)); + cstr_insert(&s1, 3, "-two"); + printf("%s\n", cstr_str(&s1)); - cstr_erase(&s1, 7, 5); // -nine - printf("%s\n", cstr_str(&s1)); + cstr_erase(&s1, 7, 5); // -nine + printf("%s\n", cstr_str(&s1)); - cstr_replace(&s1, "seven", "four", 1); - printf("%s\n", cstr_str(&s1)); + cstr_replace(&s1, "seven", "four", 1); + printf("%s\n", cstr_str(&s1)); - // reassign: - cstr_assign(&s1, "one two three four five six seven"); - cstr_append(&s1, " eight"); - printf("append: %s\n", cstr_str(&s1)); + // reassign: + cstr_assign(&s1, "one two three four five six seven"); + cstr_append(&s1, " eight"); + printf("append: %s\n", cstr_str(&s1)); - cstr full_path = cstr_from_fmt("%s/%s.%s", "directory", "filename", "ext"); - printf("%s\n", cstr_str(&full_path)); - - c_drop(cstr, &s0, &s1, &full_path); + full_path = cstr_from_fmt("%s/%s.%s", "directory", "filename", "ext"); + printf("%s\n", cstr_str(&full_path)); + } } ``` Output: |
