diff options
| author | Tyge Løvset <[email protected]> | 2022-06-01 16:28:07 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-06-01 16:28:07 +0200 |
| commit | de629774cb912aa3d563f24d99258142713c3fcd (patch) | |
| tree | c37e2851d6cb049bc0863a59b6ecf5945fb88619 /examples/sview_split.c | |
| parent | 7fb43a24a17da787dd809114ca26c1231b058493 (diff) | |
| download | STC-modified-de629774cb912aa3d563f24d99258142713c3fcd.tar.gz STC-modified-de629774cb912aa3d563f24d99258142713c3fcd.zip | |
Converted all files with DOS line endings to LINUX.
Diffstat (limited to 'examples/sview_split.c')
| -rw-r--r-- | examples/sview_split.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/examples/sview_split.c b/examples/sview_split.c index 8c3d7120..2c7ce395 100644 --- a/examples/sview_split.c +++ b/examples/sview_split.c @@ -1,21 +1,21 @@ -#define STC_IMPLEMENT
-#include <stc/cstr.h>
-#include <stc/csview.h>
-
-int main()
-{
- // No memory allocations or string length calculations!
- const csview date = c_sv("2021/03/12");
- size_t pos = 0;
- const csview year = csview_token(date, c_sv("/"), &pos);
- const csview month = csview_token(date, c_sv("/"), &pos);
- const csview day = csview_token(date, c_sv("/"), &pos);
-
- printf("%" c_PRIsv ", %" c_PRIsv ", %" c_PRIsv "\n",
- c_ARGsv(year), c_ARGsv(month), c_ARGsv(day));
-
- c_auto (cstr, y, m, d) {
- 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));
- }
-}
+#define STC_IMPLEMENT +#include <stc/cstr.h> +#include <stc/csview.h> + +int main() +{ + // No memory allocations or string length calculations! + const csview date = c_sv("2021/03/12"); + size_t pos = 0; + const csview year = csview_token(date, c_sv("/"), &pos); + const csview month = csview_token(date, c_sv("/"), &pos); + const csview day = csview_token(date, c_sv("/"), &pos); + + printf("%" c_PRIsv ", %" c_PRIsv ", %" c_PRIsv "\n", + c_ARGsv(year), c_ARGsv(month), c_ARGsv(day)); + + c_auto (cstr, y, m, d) { + 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)); + } +} |
