diff options
| author | Tyge Løvset <[email protected]> | 2022-03-16 21:41:40 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-03-16 21:41:40 +0100 |
| commit | 0468971b404cee5582d360d7d1c66bb4148e1614 (patch) | |
| tree | 9161ccbea490a5dab70e641f7bd568521a5da636 /examples/utf8replace_c.c | |
| parent | 342484f70998258022c26e6af2926ecc7635bbdd (diff) | |
| download | STC-modified-0468971b404cee5582d360d7d1c66bb4148e1614.tar.gz STC-modified-0468971b404cee5582d360d7d1c66bb4148e1614.zip | |
Bugfix: carc and cbox cmp functions had bug.
Renamed: i_key_sptr / i_val_sptr to i_key_arcbox / i_val_arcbox.
Other smaller updates.
Diffstat (limited to 'examples/utf8replace_c.c')
| -rw-r--r-- | examples/utf8replace_c.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/utf8replace_c.c b/examples/utf8replace_c.c new file mode 100644 index 00000000..e04f2cb8 --- /dev/null +++ b/examples/utf8replace_c.c @@ -0,0 +1,21 @@ +#include <stc/cstr.h> +#include <stc/csview.h> +#include <stc/utf8.h> + +int main() { + c_auto (cstr, hello) { + hello = cstr_new("hell😀 world"); + printf("%s\n", hello.str); + + cstr_replace_sv( + &hello, + utf8_substr(hello.str, 4, 1), + c_sv("🐨") + ); + printf("%s\n", hello.str); + + csview sv = csview_from_s(hello); + c_foreach (c, csview, sv) + printf(c_PRIsv ",", c_ARGsv(c.codep)); + } +} |
