summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-09-21 14:54:47 +0200
committerTyge Løvset <[email protected]>2022-09-21 14:54:47 +0200
commit307c0a111c8f063032ba90b2a7ae07122e2a2b1a (patch)
tree0c989b52d7fe4a87d11dc593df5b16579dd1bd22 /docs
parenta1d6c85b72027c9cd09d6bf0b1e0f7c3942e4aee (diff)
downloadSTC-modified-307c0a111c8f063032ba90b2a7ae07122e2a2b1a.tar.gz
STC-modified-307c0a111c8f063032ba90b2a7ae07122e2a2b1a.zip
Recent macro renames:
c_foreach_token() => c_fortoken() c_foreach_match() => c_formatch() Added: c_forfiltered() c_forpred()
Diffstat (limited to 'docs')
-rw-r--r--docs/cregex_api.md6
-rw-r--r--docs/csview_api.md8
2 files changed, 7 insertions, 7 deletions
diff --git a/docs/cregex_api.md b/docs/cregex_api.md
index 6fd5ba1d..5f7e9136 100644
--- a/docs/cregex_api.md
+++ b/docs/cregex_api.md
@@ -122,9 +122,9 @@ if (cregex_find_pattern(pattern, input, match, 0))
To compile, use: `gcc first_match.c src/cregex.c src/utf8code.c`.
In order to use a callback function in the replace call, see `examples/regex_replace.c`.
-### Iterate through matches, c_foreach_match
+### Iterate through regex matches, *c_formatch*
-To iterate multiple matches in an input string, you may use:
+To iterate multiple matches in an input string, you may use
```c
csview match[5] = {0};
while (cregex_find(&re, input, match, cre_m_next) == cre_success)
@@ -133,7 +133,7 @@ while (cregex_find(&re, input, match, cre_m_next) == cre_success)
```
There is also a safe macro which simplifies this:
```c
-c_foreach_match (it, &re, input)
+c_formatch (it, &re, input)
c_forrange (int, k, cregex_captures(&re))
printf("submatch %d: %.*s\n", k, c_ARGsv(it.match[k]));
```
diff --git a/docs/csview_api.md b/docs/csview_api.md
index 6597d192..5cc05c02 100644
--- a/docs/csview_api.md
+++ b/docs/csview_api.md
@@ -79,11 +79,11 @@ csview cstr_u8_substr(const cstr* self, size_t bytepos, size_t u8len);
csview cstr_slice(const cstr* self, size_t p1, size_t p2);
csview cstr_slice_ex(const cstr* s, intptr_t p, intptr_t q); // negative p or q count from end
```
-#### Iterate tokens with *c_foreach_token*, *c_foreach_token_sv*
+#### Iterate tokens with *c_fortoken*, *c_fortoken_sv*
To iterate tokens in an input string separated by a string:
```c
-c_foreach_token (i, "hello, one, two, three", ", ")
+c_fortoken (i, "hello, one, two, three", ", ")
printf("token: %.*s\n", c_ARGsv(i.token));
```
@@ -174,7 +174,7 @@ and does not depend on null-terminated strings. *string_split()* function return
void print_split(csview input, csview sep)
{
- c_foreach_token_sv (i, input, sep)
+ c_fortoken_sv (i, input, sep)
printf("[%.*s]\n", c_ARGsv(i.token));
}
@@ -186,7 +186,7 @@ cstack_str string_split(csview input, csview sep)
{
cstack_str out = cstack_str_init();
- c_foreach_token_sv (i, input, sep)
+ c_fortoken_sv (i, input, sep)
cstack_str_push(&out, cstr_from_sv(i.token));
return out;