summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authortylov <[email protected]>2023-08-14 10:33:32 +0200
committertylov <[email protected]>2023-08-14 10:33:32 +0200
commit2b6b4785c5c26bc47d800c1a7c7a48784df2d57b (patch)
treea3eae4bf9e58fac8f1d1eebd3df7ab7e7d6003b3 /docs
parentfb5863de1d6ea8a5be8371e57bcd58bf31798a0a (diff)
downloadSTC-modified-2b6b4785c5c26bc47d800c1a7c7a48784df2d57b.tar.gz
STC-modified-2b6b4785c5c26bc47d800c1a7c7a48784df2d57b.zip
Some docs updates.
Diffstat (limited to 'docs')
-rw-r--r--docs/csubstr_api.md9
-rw-r--r--docs/csview_api.md8
2 files changed, 9 insertions, 8 deletions
diff --git a/docs/csubstr_api.md b/docs/csubstr_api.md
index 6cf76cf7..7094cf82 100644
--- a/docs/csubstr_api.md
+++ b/docs/csubstr_api.md
@@ -1,18 +1,19 @@
-# STC [csubstr](../include/stc/csubstr.h): String View
+# STC [csubstr](../include/stc/csubstr.h): Sub-string View
![String](pics/string.jpg)
The type **csubstr** is a non-null terminated string view and can refer to a constant contiguous sequence of
char-elements with the first element of the sequence at position zero. The implementation holds two members:
a pointer to constant char and a size.
-Because **csubstr** is non-null terminated, it is not a replacent for `const char*` - see [csview](csview_api.md)
+Because **csubstr** is non-null terminated, it is not a replacent view for `const char*` - see [csview](csview_api.md)
for that. **csubstr** never allocates memory, and therefore need not be destructed. Its lifetime is limited by
the source string storage. It keeps the length of the string, and does not need to call *strlen()* to acquire
the length.
-Note: a **csubstr** must be printed the following way:
+- **csubstr** iterators works on UTF8 codepoints - like **cstr** and **csview** (see Example 2).
+- Because it is null-terminated, it must be printed the following way:
```c
-printf("%.*s", c_SS(sstr))
+printf("%.*s", c_SS(sstr));
```
See the c++ class [std::basic_string_view](https://en.cppreference.com/w/cpp/string/basic_string_view) for a functional
diff --git a/docs/csview_api.md b/docs/csview_api.md
index f7e0e2b0..d28e3ed2 100644
--- a/docs/csview_api.md
+++ b/docs/csview_api.md
@@ -1,4 +1,4 @@
-# STC [csview](../include/stc/csview.h): String View
+# STC [csview](../include/stc/csview.h): Null-terminated UTF8 String View
![String](pics/string.jpg)
The type **csview** is a ***null-terminated*** string view and refers to a constant contiguous sequence of
@@ -6,9 +6,9 @@ char-elements with the first element of the sequence at position zero. The imple
members: a pointer to constant char and a size. See [csubstr](csubstr_api.md) for a ***non null-terminated***
string view/span type.
-Because **csview** is null-terminated, it can be a more efficient replacent for `const char*`. It never
-allocates memory, and need therefore not be destructed. Its lifetime is limited by the source string
-storage. It keeps the length of the string, and does not call *strlen()* when passing it around.
+Because **csview** is null-terminated, it can be an efficient replacent for `const char*`. It never
+allocates memory, and therefore need not be destructed. Its lifetime is limited by the source string
+storage. It keeps the length of the string, i.e. no need to call *strlen()* for various operations.
## Header file