|
cbase 1.50.0
C/C++ Static Template
|
Functions | |
| static String8 | str8 (u8 *str, usize size) |
| Creates a String8 from a raw pointer and explicit byte length. | |
| static String8 | str8_range (u8 *first, u8 *one_past_last) |
Creates a String8 spanning from first to one_past_last. | |
| static String8 | str8_cstr (const char *cstr) |
| Converts a null-terminated C string into a String8. | |
| static String8 | str8_prefix (String8 str, usize size) |
Returns the first size bytes of str. | |
| static String8 | str8_suffix (String8 str, usize size) |
Returns the last size bytes of str. | |
| static String8 | str8_skip (String8 str, usize amt) |
Returns str with the first amt bytes removed. | |
| static String8 | str8_chop (String8 str, usize amt) |
Returns str with the last amt bytes removed. | |
| static String8 | str8_substr (String8 str, usize first, usize one_past_last) |
Returns the substring from byte index first to one_past_last. | |
| static b32 | str8_match (String8 a, String8 b) |
Returns 1 if a and b contain identical bytes (case-sensitive). | |
| static b32 | str8_match_nocase (String8 a, String8 b) |
Returns 1 if a and b are equal ignoring ASCII case. | |
| static b32 | str8_starts_with (String8 str, String8 prefix) |
Returns 1 if str begins with prefix. | |
| static b32 | str8_ends_with (String8 str, String8 suffix) |
Returns 1 if str ends with suffix. | |
| static usize | str8_find_first (String8 str, u8 byte) |
Returns the byte index of the first occurrence of byte in str. | |
| static void | str8_list_push (String8List *list, String8Node *node, String8 str) |
| Appends a String8 to a String8List via a caller-allocated node. | |
Creates a String8 from a raw pointer and explicit byte length.
| str | Pointer to the start of the string data. |
| size | Length in bytes. |
Definition at line 133 of file base_strings.h.

Returns str with the last amt bytes removed.
| str | The source string. |
| amt | Number of bytes to remove from the back. |
amt bytes before the original end. Definition at line 210 of file base_strings.h.

|
inlinestatic |
Converts a null-terminated C string into a String8.
| cstr | Null-terminated C string, or NULL. |
Definition at line 158 of file base_strings.h.


Returns 1 if str ends with suffix.
| str | The string to test. |
| suffix | The suffix to look for. |
str ends with suffix, 0 otherwise. Definition at line 289 of file base_strings.h.

Returns the byte index of the first occurrence of byte in str.
| str | The string to search. |
| byte | The byte value to find. |
str.size if not found. Definition at line 304 of file base_strings.h.
|
inlinestatic |
Appends a String8 to a String8List via a caller-allocated node.
| list | The list to append to. |
| node | A caller-allocated node to link into the list. |
| str | The string slice to store in the node. |
Definition at line 321 of file base_strings.h.
Returns 1 if a and b contain identical bytes (case-sensitive).
| a | First string. |
| b | Second string. |
Definition at line 239 of file base_strings.h.

Returns 1 if a and b are equal ignoring ASCII case.
| a | First string. |
| b | Second string. |
Definition at line 254 of file base_strings.h.
Returns the first size bytes of str.
| str | The source string. |
| size | Number of bytes to keep from the front. |
size bytes. Definition at line 171 of file base_strings.h.


Creates a String8 spanning from first to one_past_last.
| first | Pointer to the first byte of the slice. |
| one_past_last | Pointer one byte past the last byte of the slice. |
Definition at line 146 of file base_strings.h.
Returns str with the first amt bytes removed.
| str | The source string. |
| amt | Number of bytes to skip from the front. |
amt bytes into str. Definition at line 197 of file base_strings.h.

Returns 1 if str begins with prefix.
| str | The string to test. |
| prefix | The prefix to look for. |
str starts with prefix, 0 otherwise. Definition at line 274 of file base_strings.h.

Returns the substring from byte index first to one_past_last.
| str | The source string. |
| first | Index of the first byte to include. |
| one_past_last | Index one past the last byte to include. |
Definition at line 224 of file base_strings.h.

Returns the last size bytes of str.
| str | The source string. |
| size | Number of bytes to keep from the back. |
size bytes from the end. Definition at line 184 of file base_strings.h.

