diff options
| author | Tyge Løvset <[email protected]> | 2023-08-14 16:46:24 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-08-14 16:46:24 +0200 |
| commit | 78d8668e6d527070568a405408ed906e51055bf4 (patch) | |
| tree | 60f963a36826acce264c7ecd0af3eb80502a4335 /misc/examples/strings/sview_split.c | |
| parent | 2b6b4785c5c26bc47d800c1a7c7a48784df2d57b (diff) | |
| download | STC-modified-78d8668e6d527070568a405408ed906e51055bf4.tar.gz STC-modified-78d8668e6d527070568a405408ed906e51055bf4.zip | |
Reverted csubstr => csview. Sorry about that!
Added crawstr to become the null-terminated string view.
Diffstat (limited to 'misc/examples/strings/sview_split.c')
| -rw-r--r-- | misc/examples/strings/sview_split.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/misc/examples/strings/sview_split.c b/misc/examples/strings/sview_split.c index 6abbf5e7..ac275da0 100644 --- a/misc/examples/strings/sview_split.c +++ b/misc/examples/strings/sview_split.c @@ -1,20 +1,20 @@ #define i_implement #include <stc/cstr.h> #define i_implement -#include <stc/csubstr.h> +#include <stc/csview.h> int main(void) { // No memory allocations or string length calculations! - const csubstr date = c_ss("2021/03/12"); + const csview date = c_sv("2021/03/12"); intptr_t pos = 0; - const csubstr year = csubstr_token(date, "/", &pos); - const csubstr month = csubstr_token(date, "/", &pos); - const csubstr day = csubstr_token(date, "/", &pos); + const csview year = csview_token(date, "/", &pos); + const csview month = csview_token(date, "/", &pos); + const csview day = csview_token(date, "/", &pos); - printf("%.*s, %.*s, %.*s\n", c_SS(year), c_SS(month), c_SS(day)); + printf("%.*s, %.*s, %.*s\n", c_SV(year), c_SV(month), c_SV(day)); - cstr y = cstr_from_ss(year), m = cstr_from_ss(month), d = cstr_from_ss(day); + cstr y = cstr_from_sv(year), m = cstr_from_sv(month), d = cstr_from_sv(day); printf("%s, %s, %s\n", cstr_str(&y), cstr_str(&m), cstr_str(&d)); c_drop(cstr, &y, &m, &d); } |
