forked from lolo859/vystem
1.2 KiB
1.2 KiB
Strings operations
The Shelter standard library provides basic strings operations primitives, defined in shelter/lib/include/std/string.h and implemented inside shelter/lib/src/std/string.c:
sh_string_len(char *str): return the length of a null terminated stringsh_string_compare(char *str1,char* str2,sh_uint64 length): compare two null terminated string, both strings must not exceed the provided length. returnSH_TRUEif both strings are equal on the provided lengthsh_string_find_char(char *str,char character): return the index of the first occurence of the provide character into the string, returnSH_UINT64_MAXif not found or errorsh_string_find(char *str,char *substr): return the index of the start of the first occurence of the provided substring into the string, returnSH_UINT64_MAXif not found or errorsh_string_substring(char *source_str,sh_uint64 start_index,sh_uint64 length,char *output): copy a substring from a string to another string, and return the pointer to the new null terminated string (aka the providedoutputpointer). ReturnSH_NULLPTRif errorsh_string_to_uint64(char *str): convert a string to ash_uint64and return thissh_uint64