String#
String module provides APIs to handle string-related operations.
Functions#
Copy a string into a buffer.
Append the source string to the end of destination string.
Get the string length.
Get the string length, limited to given length.
Check if the string is empty.
Compare two strings, ignoring case.
Searches for the character in memory, in reverse order.
Function Documentation#
sl_strcpy_s#
void sl_strcpy_s (char * dst, size_t dst_size, const char * src)
Copy a string into a buffer.
[in] | dst | Destination buffer. |
[in] | dst_size | The size of the destination buffer. |
[in] | src | Source string. |
Normally, the complete source string including the '\0' termination will be copied to the destination. If the destination buffer doesn't have room to receive the complete source string, the source string will be truncated and the destination buffer will be '\0' terminated within the destination buffer.
69
of file platform/common/inc/sl_string.h
sl_strcat_s#
void sl_strcat_s (char * dst, size_t dst_size, const char * src)
Append the source string to the end of destination string.
[in] | dst | Destination string. |
[in] | dst_size | The size of the destination string buffer. |
[in] | src | Source string. |
Normally, the complete source string including the '\0' termination will be appended to the destination, starting at the source strings '\0' termination. If the destination buffer has no room to receive the complete source string, the source string will be truncated and the destination '\0' terminated within the destination buffer.
86
of file platform/common/inc/sl_string.h
sl_strlen#
size_t sl_strlen (char * str)
Get the string length.
[in] | str | The string to get the length for. |
Returns
String lenght.
96
of file platform/common/inc/sl_string.h
sl_strnlen#
size_t sl_strnlen (char * str, size_t max_len)
Get the string length, limited to given length.
[in] | str | The string to get the length for. |
[in] | max_len | The input string is searched for at most max_lencharacters. |
Returns
String lenght.
108
of file platform/common/inc/sl_string.h
sl_str_is_empty#
bool sl_str_is_empty (const char * str)
Check if the string is empty.
[in] | str | The string to check. |
Returns
true if string is empty or null, else return false.
118
of file platform/common/inc/sl_string.h
sl_strcasecmp#
int sl_strcasecmp (char const * a, char const * b)
Compare two strings, ignoring case.
[in] | a | String to compare. |
[in] | b | String to compare. |
Returns
An integer greater than, or less than 0 if the strings are not equal. 0 if the strings are equal.
131
of file platform/common/inc/sl_string.h
sl_memrchr#
void * sl_memrchr (void const * buff, char c, size_t buff_len)
Searches for the character in memory, in reverse order.
[in] | buff | Address of the memory buffer. |
[in] | c | Character to look for. |
[in] | buff_len | Length of the memory buffer. |
Returns
The address of the character in the buffer if and only if it was found. NULL if no character was found.
147
of file platform/common/inc/sl_string.h