libstring
simple flexible string manipulation library
|
All functions in libstring. More...
#include "libstring.h"
Functions | |
string | string_new () |
uint16_t | string_bavail (string a) |
string | string_realloc (string a, uint16_t minS) |
string | string_copy (string a, const string b, uint16_t offset, uint16_t num) |
string | string_dup (const string a) |
string | string_temporary (string in) |
string | string_mknew (const string_unit *in) |
string | string_appendv (int count,...) |
Variables | |
uint16_t | allocS [] = {16, 32, 64, 256, 512, 1024, 2048, 4096, 8192, 12288, 0} |
All functions in libstring.
string string_appendv | ( | int | count, |
... | |||
) |
Append a variable number of strings
uint16_t string_bavail | ( | string | a | ) |
Get the number of bytes available in the string
Copy num characters from string B to A with offset offset.
if num is 0, then all characters will be copied.
a string #1 b string #2 offset offset num number
Make a duplicate of a string
a string
string string_mknew | ( | const string_unit * | in | ) |
Duplicate a non-library string
Use this function if you are concerned about reads before the string
string string_new | ( | ) |
Create a new string
Reallocate string A with minimum size
a the string to reallocate minS the minimum size of the string
Declare a string as temporary, ie, that it will be freed right after use
If the string is not library-compatible, nothing happens.
uint16_t allocS[] = {16, 32, 64, 256, 512, 1024, 2048, 4096, 8192, 12288, 0} |
Allocation sizes by default
Each one is ~double the previous one
The 0 just means allocate as much as needed, no extras