diff options
| author | Tyge Løvset <[email protected]> | 2022-07-27 15:22:38 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-07-27 15:22:38 +0200 |
| commit | c37abf4f78b97244e92cba6c352501a4d22110cf (patch) | |
| tree | 12c49ad74db06641bd7764ea64f5cb56e9fa3f26 /examples/utf8replace_c.c | |
| parent | 2bae847079852eb808e50a136659e98898616bef (diff) | |
| download | STC-modified-c37abf4f78b97244e92cba6c352501a4d22110cf.tar.gz STC-modified-c37abf4f78b97244e92cba6c352501a4d22110cf.zip | |
VERSION 3.8 BETA: Some changes in cstr / csview APIs: replace* / find*, *_u8(). . See README.md
Diffstat (limited to 'examples/utf8replace_c.c')
| -rw-r--r-- | examples/utf8replace_c.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/utf8replace_c.c b/examples/utf8replace_c.c index c38b37e4..86d8bd69 100644 --- a/examples/utf8replace_c.c +++ b/examples/utf8replace_c.c @@ -1,3 +1,4 @@ +#define i_implement #include <stc/cstr.h> #include <stc/csview.h> @@ -6,14 +7,12 @@ int main() { hello = cstr_new("hell😀 w😀rld"); printf("%s\n", cstr_str(&hello)); - cstr_replace_sv( - &hello, - csview_substr_u8(cstr_sv(&hello), 7, 1), - c_sv("🐨") - ); + /* replace second smiley at utf8 codepoint pos 7 */ + cstr_u8_replace_at(&hello, 7, 1, c_sv("🐨")); + printf("%s\n", cstr_str(&hello)); - cstr_replace(&hello, "🐨", "ø"); + cstr_replace(&hello, "🐨", "ø", 1); printf("%s\n", cstr_str(&hello)); c_foreach (c, cstr, hello) |
