diff options
| author | Tyge Løvset <[email protected]> | 2022-09-06 23:09:01 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-06 23:09:01 +0200 |
| commit | eecb27a6cf9642d488c9bd2bbaa139dce4875520 (patch) | |
| tree | 7ebd9815f5fa5565783eeb007f63d65ae900020e /docs | |
| parent | a65d94a54ba98ca1fa743d6c70a9b243afad47da (diff) | |
| download | STC-modified-eecb27a6cf9642d488c9bd2bbaa139dce4875520.tar.gz STC-modified-eecb27a6cf9642d488c9bd2bbaa139dce4875520.zip | |
Update csview_api.md
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/csview_api.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/csview_api.md b/docs/csview_api.md index 9da64cb2..46560fa9 100644 --- a/docs/csview_api.md +++ b/docs/csview_api.md @@ -79,7 +79,7 @@ csview cstr_u8_substr(const cstr* self, size_t bytepos, size_t u8len); csview cstr_slice(const cstr* self, size_t p1, size_t p2); csview cstr_slice_ex(const cstr* s, intptr_t p, intptr_t q); // negative p or q count from end ``` -### Iterate tokens: c_foreach_token, c_foreach_token_sv +#### Iterate tokens with *c_foreach_token*, *c_foreach_token_sv* To iterate tokens in an input string separated by a string: ```c @@ -126,8 +126,8 @@ int main () size_t pos = cstr_find(&str1, "live"); // position of "live" in str1 csview sv2 = cstr_substr(&str1, pos, 4); // get "live" csview sv3 = cstr_slice(&str1, -8, -1); // get "details" - printf("%" c_PRIsv "%" c_PRIsv "%" c_PRIsv "\n", - c_ARGsv(sv1), c_ARGsv(sv2), c_ARGsv(sv3)); + printf("%.*s %.*s %.*s\n", + c_ARGsv(sv1), c_ARGsv(sv2), c_ARGsv(sv3)); cstr s1 = cstr_new("Apples are red"); cstr s2 = cstr_from_sv(cstr_substr(&s1, -3, 3)); // "red" cstr s3 = cstr_from_sv(cstr_substr(&s1, 0, 6)); // "Apples" |
