summaryrefslogtreecommitdiffhomepage
path: root/docs/cstr_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-29 00:28:50 +0100
committerTyge Løvset <[email protected]>2022-12-29 00:28:50 +0100
commit0761c13f316cc98ae7756f3527931aa86bed5016 (patch)
treee90777558956fcf91d6b1c958e0c3a6fb0ab007f /docs/cstr_api.md
parentd623c6c85071b9af5d607bb5d9aceceaea05220a (diff)
downloadSTC-modified-0761c13f316cc98ae7756f3527931aa86bed5016.tar.gz
STC-modified-0761c13f316cc98ae7756f3527931aa86bed5016.zip
Restructuring of some headers into include/algo folder. Some API changes *_replace*() functions have been renamed, and a few minor API changes.
Diffstat (limited to 'docs/cstr_api.md')
-rw-r--r--docs/cstr_api.md7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/cstr_api.md b/docs/cstr_api.md
index 3857633a..0ee8b2cb 100644
--- a/docs/cstr_api.md
+++ b/docs/cstr_api.md
@@ -68,7 +68,8 @@ void cstr_insert_s(cstr* self, size_t pos, cstr ins);
void cstr_erase(cstr* self, size_t pos, size_t len); // erase len bytes from pos
-void cstr_replace(cstr* self, const char* search, const char* repl, unsigned count); // count==0: replace all.
+void cstr_replace(cstr* self, const char* search, const char* repl);
+void cstr_replace_ex(cstr* self, const char* search, const char* repl, unsigned count);
cstr cstr_replace_sv(csview in, csview search, csview repl, unsigned count);
void cstr_replace_at(cstr* self, size_t pos, size_t len, const char* repl); // replace at a position
void cstr_replace_at_sv(cstr* self, size_t pos, size_t len, const csview repl);
@@ -101,7 +102,7 @@ size_t cstr_u8_size_n(const cstr self, size_t nbytes); // utf8 si
size_t cstr_u8_to_pos(const cstr* self, size_t u8idx); // byte pos offset at utf8 codepoint index
const char* cstr_u8_at(const cstr* self, size_t u8idx); // char* position at utf8 codepoint index
csview cstr_u8_chr(const cstr* self, size_t u8idx); // get utf8 character as a csview
-void cstr_u8_replace(cstr* self, size_t bytepos, size_t u8len, csview repl); // replace u8len utf8 chars
+void cstr_u8_replace_at(cstr* self, size_t bytepos, size_t u8len, csview repl); // replace u8len utf8 chars
void cstr_u8_erase(cstr* self, size_t bytepos, size_t u8len); // erase u8len codepoints from pos
// iterate utf8 codepoints
@@ -173,7 +174,7 @@ int main() {
cstr_erase(&s1, 7, 5); // -nine
printf("%s\n", cstr_str(&s1));
- cstr_replace(&s1, "seven", "four", 1);
+ cstr_replace_ex(&s1, "seven", "four", 1);
printf("%s\n", cstr_str(&s1));
// reassign: