18 lines
1.0 KiB
C
18 lines
1.0 KiB
C
// SPDX-License-Identifier: MPL-2.0
|
|
#ifndef SH_LIB_STRING_H
|
|
#define SH_LIB_STRING_H
|
|
#include "std/type.h"
|
|
// Return the length of a null terminated string
|
|
sh_uint64 sh_string_len(char *str);
|
|
// Compare two null terminated string, both strings must not exceed the provided length. Return SH_TRUE if both strings are equals on the provided length
|
|
sh_bool sh_string_compare(char *str1,char* str2,sh_uint64 length);
|
|
// Return the index of the first occurence of the provided character into the string, return SH_UINT64_MAX if not found or error
|
|
sh_uint64 sh_string_find_char(char *str,char character);
|
|
// Return the index of the start of the first occurence of the provided substring into the string, return SH_UINT64_MAX if not found or error
|
|
sh_uint64 sh_string_find(char *str,char *substr);
|
|
// Copy a substring from a string to another string, and return the pointer to the new string
|
|
char *sh_string_substring(char *source_str,sh_uint64 start_index,sh_uint64 length,char *output);
|
|
// Convert a string to a sh_uint64
|
|
sh_uint64 sh_string_to_uint64(char *str);
|
|
#endif
|