Skip to content

Commit 374a67a

Browse files
author
none
committed
docs: Add functions listing in the README.md
1 parent ea0eede commit 374a67a

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This library is header-only and follows the [stb-style](https://github.com/nothi
55
For more information about this style read [this](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt).
66

77
> [!NOTE]
8-
> This library uses C99 features (inline functions).
8+
> This library uses **C99** features ([Inline functions](https://en.wikipedia.org/wiki/Inline_function)).
99
1010
```c
1111

@@ -53,3 +53,52 @@ No linking or stuff like that is needed.
5353
> printf(STRING_VIEW_FORMAT "\n", STRING_VIEW_ARG(sv));
5454
> }
5555
> ```
56+
57+
## Documentation
58+
59+
The full documentation is situated inside the [string_view.h](./string_view.h) file.
60+
61+
## Implemented functions
62+
63+
| Function | Brief |
64+
|------------------------------|------------------------------------------------------------------------|
65+
| `new_string_view` | Creates a new string view from a character array and length |
66+
| `new_string_view_from_cstr` | Creates a new string view from a null-terminated character string |
67+
| `string_view_data` | Returns a pointer to the underlying character data of the string view |
68+
| `string_view_size` | Returns the length of the string view |
69+
| `string_view_at` | Returns the character at the specified index in the string view |
70+
| `string_view_front` | Returns the first character of the string view |
71+
| `string_view_back` | Returns the last character of the string view |
72+
| `string_view_is_empty` | Checks if the string view is empty |
73+
| `string_view_trim_left` | Trims whitespace characters from the beginning of a string view |
74+
| `string_view_trim_right` | Trims whitespace characters from the end of a string view |
75+
| `string_view_trim` | Trims whitespace characters from both ends of a string view |
76+
| `string_view_remove_prefix` | Removes a prefix of specified length from a string view |
77+
| `string_view_remove_suffix` | Removes a suffix of specified length from a string view |
78+
| `string_view_swap` | Swaps the contents of two string views |
79+
| `string_view_copy` | Copies a portion of a string view into a character array |
80+
| `string_view_substr` | Creates a new string view that is a substring of the given string view |
81+
| `string_view_compare` | Compares two string views lexicographically |
82+
| `string_view_equal` | Checks if two string views are equal |
83+
| `string_view_starts_with` | Checks if a string view starts with a given prefix |
84+
| `string_view_ends_with` | Checks if a string view ends with a given suffix |
85+
| `string_view_find_char` | Finds the first occurrence of a character in a string view |
86+
| `string_view_find_substring` | Finds the first occurrence of a substring within a string view |
87+
88+
> [!NOTE]
89+
> **string_view_contains** is dependent on the C standard version.
90+
>
91+
> In **C11** is defined as a macro that uses `_Generic` to dispatch the correct implementation.
92+
>
93+
> | Macro | Brief |
94+
> |----------------------------------|------------------------------------------------------|
95+
> | `string_view_contains` | Checks if a string view contains a specified element |
96+
>
97+
> In **C99**, two separate macros are defined for character and substring checks:
98+
>
99+
> | Macro | Brief |
100+
> |----------------------------------|-------------------------------------------------------|
101+
> | `string_view_contains_char` | Checks if a string view contains a specific character |
102+
> | `string_view_contains_substring` | Checks if a string view contains a specific substring |
103+
>
104+

0 commit comments

Comments
 (0)