Functionality for creating SQL queries, making strong passwords, trimming a string if there are any space characters, parsing string as URL.
More...
|
| char * | mkpasswd (char *s, size_t size) |
| | make strong password More...
|
| |
| int | re_strcmp (const char *s, const char *mask) |
| | compare string with regular expression mask More...
|
| |
| char * | str_cat (char **dest, const char *src) |
| | Concatenate dynamically allocated string with constant string. More...
|
| |
| char * | str_ncat (char **dest, const char *src, size_t n) |
| | Similar to str_cat() except it will use at most n bytes from src. More...
|
| |
| char * | str_replace (const char *search, const char *replace, const char *subject) |
| | Replace all occurrences of the search string with the replacement string. More...
|
| |
| size_t | strlcpy (char *dst, const char *src, size_t size) |
| | Size-bounded string copying. More...
|
| |
| size_t | strlcat (char *dst, const char *src, size_t size) |
| | Size-bounded string concatenation. More...
|
| |
| void | trim (char *s) |
| | trim string More...
|
| |
| void | ltrim (char *s) |
| | trim string from left More...
|
| |
| void | rtrim (char *s) |
| | trim string from right More...
|
| |
Functionality for creating SQL queries, making strong passwords, trimming a string if there are any space characters, parsing string as URL.
trim string from left
- Parameters
-
| [in,out] | s | pointer to string |
| char* mkpasswd |
( |
char * |
s, |
|
|
size_t |
size |
|
) |
| |
make strong password
- Parameters
-
| [out] | s | NULL-terminated string with password |
| [in] | size | buffer size at pointer s |
- Returns
- pointer to
s or NULL, if failed
This function use random(), so before using you should initialize random seed by some value, for example by this call srandom(time(NULL))
| int re_strcmp |
( |
const char * |
s, |
|
|
const char * |
mask |
|
) |
| |
compare string with regular expression mask
- Parameters
-
| [in] | s | string |
| [in] | mask | regular expression mask |
- Returns
- zero if string is matched
trim string from right
- Parameters
-
| [in,out] | s | pointer to string |
| char* str_cat |
( |
char ** |
dest, |
|
|
const char * |
src |
|
) |
| |
Concatenate dynamically allocated string with constant string.
- Parameters
-
| [in,out] | dest | pointer to pointer of dynamically allocated string |
| [in] | src | pointer to constant string |
- Returns
- pointer to concatenated string
- Return values
-
| char* str_ncat |
( |
char ** |
dest, |
|
|
const char * |
src, |
|
|
size_t |
n |
|
) |
| |
Similar to str_cat() except it will use at most n bytes from src.
- Parameters
-
| [in,out] | dest | pointer to pointer of dynamically allocated string |
| [in] | src | pointer to constant string |
| [in] | n | limit constant string length |
- Returns
- pointer to concatenated string
- Return values
-
| char* str_replace |
( |
const char * |
search, |
|
|
const char * |
replace, |
|
|
const char * |
subject |
|
) |
| |
Replace all occurrences of the search string with the replacement string.
- Parameters
-
| [in] | search | value being searched for |
| [in] | replace | replacement value that replaces found search values |
| [in] | subject | string being searched and replaced on |
- Returns
- pointer to allocated string
- Return values
-
| size_t strlcat |
( |
char * |
dst, |
|
|
const char * |
src, |
|
|
size_t |
size |
|
) |
| |
Size-bounded string concatenation.
- Parameters
-
| [in] | dst | string to be appended to |
| [in] | src | string to append to it |
| [in] | size | size of the destination buffer |
- Returns
- total length of the string tried to create
| size_t strlcpy |
( |
char * |
dst, |
|
|
const char * |
src, |
|
|
size_t |
size |
|
) |
| |
Size-bounded string copying.
- Parameters
-
| [in] | dst | where to copy the string to |
| [in] | src | where to copy the string from |
| [in] | size | size of the destination buffer |
- Returns
- total length of the string tried to create
trim string
- Parameters
-
| [in,out] | s | pointer to string |