Turnstone Operating System
|
main string operations interface More...
Macros | |
#define | ___STRINGS_H 0 |
#define | strcontains(str, pattern) (strstr(str, pattern) != NULL) |
checks str contains pattern More... | |
#define | strcat(s1, s2) strcat_at_heap(NULL, s1, s2) |
#define | atoi(number) ato_base(number, 10) |
#define | atou(number) atou_base(number, 16) |
#define | atoh(number) atou_base(number, 16) |
#define | itoa(number) ito_base(number, 10) |
#define | itoh(number) ito_base(number, 16) |
#define | utoa(number) uto_base(number, 10) |
#define | utoh(number) uto_base(number, 16) |
#define | strdup_at_heap(heap, src) strndup_at_heap(heap, src, strlen(src)) |
#define | strdup(src) strndup_at_heap(NULL, src, strlen(src)) |
#define | strndup(src, n) strndup_at_heap(NULL, src, n) |
Functions | |
size_t | strlen (const char_t *string) |
calculates null ended string's length More... | |
int8_t | strcmp (const char_t *string1, const char_t *string2) |
compares two string More... | |
int8_t | strncmp (const char_t *string1, const char_t *string2, size_t n) |
compares two string with first n bytes More... | |
int8_t | strstarts (const char_t *str, const char_t *prefix) |
checks str starts with prefix More... | |
int8_t | strends (const char_t *str, const char_t *suffix) |
checks str ends with suffix More... | |
char_t * | strchr (const char_t *s, int32_t c) |
finds first occurance of char in string More... | |
char_t * | strrchr (const char_t *s, int32_t c) |
finds first occurance of char in string More... | |
char_t * | strstr (const char_t *haystack, const char_t *needle) |
finds first occurance of char in string More... | |
char_t * | strcat_at_heap (memory_heap_t *heap, const char_t *string1, const char_t *string2) |
concanates two string and returns new one More... | |
int8_t | strcpy (const char_t *source, char_t *destination) |
copies source string to destination string More... | |
char * | strrev (const char_t *source) |
reverse a string More... | |
number_t | ato_base (const char_t *source, number_t base) |
converts string into number More... | |
unumber_t | atou_base (const char_t *source, number_t base) |
converts string into number More... | |
char_t * | ito_base (number_t number, number_t base) |
convers number to its string representation More... | |
char_t * | uto_base (unumber_t number, number_t base) |
convers unsigned number to its string representation More... | |
char_t * | strndup_at_heap (memory_heap_t *heap, const char_t *src, size_t n) |
duplicate string at heap More... | |
char_t ** | strsplit (const char_t *str, const char_t token, int64_t **lengths, int64_t *count) |
splits string into array More... | |
char_t * | strupper (char_t *str) |
converts string to upper case More... | |
char_t * | struppercopy (const char_t *str) |
duplicates string and converts it to upper case More... | |
char_t * | strlower (char_t *str) |
converts string to lower case More... | |
char_t * | strlowercopy (const char_t *str) |
duplicates string and converts it to lower case More... | |
char_t * | strtrim_right (char_t *str) |
int8_t | str_is_upper (char_t *str) |
int64_t | wchar_size (const wchar_t *str) |
char_t * | wchar_to_char (wchar_t *src) |
wchar_t * | char_to_wchar (const char_t *str) |
int64_t | lchar_size (const lchar_t *str) |
char_t * | lchar_to_char (lchar_t *src) |
lchar_t * | char_to_lchar (char_t *str) |
uint64_t | strhash (const char_t *input) |
char_t * | sprintf (const char_t *format,...) |
char_t * | vsprintf (const char_t *format, va_list args) |
main string operations interface
>
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
#define ___STRINGS_H 0 |
prevent duplicate header error macro
#define atoh | ( | number | ) | atou_base(number, 16) |
atou_base macro for base 16
#define atoi | ( | number | ) | ato_base(number, 10) |
ato_base macro for base 10
#define atou | ( | number | ) | atou_base(number, 16) |
atou_base macro for base 10
#define itoa | ( | number | ) | ito_base(number, 10) |
ito_base macro for base 10
#define itoh | ( | number | ) | ito_base(number, 16) |
ito_base macro for base 16
#define strcat | ( | s1, | |
s2 | |||
) | strcat_at_heap(NULL, s1, s2) |
strcat at default heap
#define strcontains | ( | str, | |
pattern | |||
) | (strstr(str, pattern) != NULL) |
checks str contains pattern
str | string for look |
pattern | to check |
#define strdup | ( | src | ) | strndup_at_heap(NULL, src, strlen(src)) |
string duplicate at default heap
#define strdup_at_heap | ( | heap, | |
src | |||
) | strndup_at_heap(heap, src, strlen(src)) |
string duplicate at heap
#define strndup | ( | src, | |
n | |||
) | strndup_at_heap(NULL, src, n) |
string duplicate with length at default heap
converts string into number
[in] | source | string represents number in base |
[in] | base | base of number inside string |
converts string into number
[in] | source | string represents number in base |
[in] | base | base of number inside string |
convers number to its string representation
[in] | number | number to be converted string |
[in] | base | base value of conversion |
return value should be freed or memory leak will be happened
char_t * strcat_at_heap | ( | memory_heap_t * | heap, |
const char_t * | string1, | ||
const char_t * | string2 | ||
) |
concanates two string and returns new one
string1 | first string |
string2 | second string |
finds first occurance of char in string
s | string for look |
c | char to find |
compares two string
string1 | first string |
string2 | second string |
copies source string to destination string
source | source string |
destination | destination string |
NULL will not be copied. destination should be equal or greater then source. destination should have space for NULL.
checks str ends with suffix
str | string for look |
suffix | to compare |
calculates null ended string's length
[in] | string | string to calculate length |
converts string to lower case
[in] | str | string to lower case |
duplicates string and converts it to lower case
[in] | str | string to lower case |
compares two string with first n bytes
string1 | first string |
string2 | second string |
n | first n bytes |
char_t * strndup_at_heap | ( | memory_heap_t * | heap, |
const char_t * | src, | ||
size_t | n | ||
) |
duplicate string at heap
[in] | heap | destination heap |
[in] | src | source string |
[in] | length | of destination string |
finds first occurance of char in string
s | string for look |
c | char to find |
char * strrev | ( | const char_t * | source | ) |
reverse a string
[in] | source | string to be reversed |
allocates new space, hence return value needs be freed, else leak will be happened
splits string into array
[in] | str | string to tokinize |
[in] | token | split char |
[out] | lengths | array of each splitted part's length |
[out] | count | splitted array length |
checks str starts with prefix
str | string for look |
prefix | to compare |
finds first occurance of char in string
s | string for look |
c | char to find |
converts string to upper case
[in] | str | string to upper case |
duplicates string and converts it to upper case
[in] | str | string to upper case |