lv_string.h
API reference for lv_string.h
Functions
lv_memcpy
Copies a block of memory from a source address to a destination address.
void * lv_memcpy(void *dst, const void *src, size_t len)| Name | Type | Description |
|---|---|---|
dst | void * | Pointer to the destination array where the content is to be copied. |
src | const void * | Pointer to the source of data to be copied. |
len | size_t | Number of bytes to copy. |
Returns: void * — Pointer to the destination array.
The function does not check for any overlapping of the source and destination memory blocks.
lv_memset
Fills a block of memory with a specified value.
void lv_memset(void *dst, uint8_t v, size_t len)lv_memmove
Move a block of memory from source to destination.
void * lv_memmove(void *dst, const void *src, size_t len)| Name | Type | Description |
|---|---|---|
dst | void * | Pointer to the destination array where the content is to be copied. |
src | const void * | Pointer to the source of data to be copied. |
len | size_t | Number of bytes to copy |
Returns: void * — Pointer to the destination array.
lv_memcmp
This function will compare two memory blocks.
int lv_memcmp(const void *p1, const void *p2, size_t len)| Name | Type | Description |
|---|---|---|
p1 | const void * | Pointer to the first memory block |
p2 | const void * | Pointer to the second memory block |
len | size_t | Number of bytes to compare |
Returns: int — The difference between the value of the first unmatching byte.
lv_memzero
Same as memset(dst, 0x00, len).
static void lv_memzero(void *dst, size_t len)| Name | Type | Description |
|---|---|---|
dst | void * | pointer to the destination buffer |
len | size_t | number of byte to set |
lv_strlen
Computes the length of the string str up to (but not including) the terminating null character.
size_t lv_strlen(const char *str)| Name | Type | Description |
|---|---|---|
str | const char * | Pointer to the null-terminated byte string to be examined. |
Returns: size_t — The length of the string in bytes.
lv_strnlen
Computes the length of the string str up to (but not including) the terminating null character, or the given maximum length.
size_t lv_strnlen(const char *str, size_t max_len)| Name | Type | Description |
|---|---|---|
str | const char * | Pointer to byte string that is null-terminated or at least max_len bytes long. |
max_len | size_t | Maximum number of characters to examine. |
Returns: size_t — The length of the string in bytes.
lv_strlcpy
Copies up to dst_size-1 (non-null) characters from src to dst. A null terminator is always added.
size_t lv_strlcpy(char *dst, const char *src, size_t dst_size)| Name | Type | Description |
|---|---|---|
dst | char * | Pointer to the destination array where the content is to be copied. |
src | const char * | Pointer to the source of data to be copied. |
dst_size | size_t | Maximum number of characters to be copied to dst, including the null character. |
Returns: size_t — The length of src. The return value is equivalent to the value returned by lv_strlen(src)
lv_strncpy
Copies up to dest_size characters from the string pointed to by src to the character array pointed to by dst and fills the remaining length with null bytes.
char * lv_strncpy(char *dst, const char *src, size_t dest_size)| Name | Type | Description |
|---|---|---|
dst | char * | Pointer to the destination array where the content is to be copied. |
src | const char * | Pointer to the source of data to be copied. |
dest_size | size_t | Maximum number of characters to be copied to dst. |
Returns: char * — A pointer to the destination array, which is dst.
dst will not be null terminated if dest_size bytes were copied from src before the end of src was reached.
lv_strcpy
Copies the string pointed to by src, including the terminating null character, to the character array pointed to by dst.
char * lv_strcpy(char *dst, const char *src)| Name | Type | Description |
|---|---|---|
dst | char * | Pointer to the destination array where the content is to be copied. |
src | const char * | Pointer to the source of data to be copied. |
Returns: char * — A pointer to the destination array, which is dst.
lv_strcmp
This function will compare two strings without specified length.
int lv_strcmp(const char *s1, const char *s2)| Name | Type | Description |
|---|---|---|
s1 | const char * | pointer to the first string |
s2 | const char * | pointer to the second string |
Returns: int — the difference between the value of the first unmatching character.
lv_strncmp
This function will compare two strings up to the given length.
int lv_strncmp(const char *s1, const char *s2, size_t len)| Name | Type | Description |
|---|---|---|
s1 | const char * | pointer to the first string |
s2 | const char * | pointer to the second string |
len | size_t | the maximum amount of characters to compare |
Returns: int — the difference between the value of the first unmatching character.
lv_streq
Returns true if the two strings are equal. Just a wrapper around strcmp for convenience.
static bool lv_streq(const char *s1, const char *s2)| Name | Type | Description |
|---|---|---|
s1 | const char * | pointer to the first string |
s2 | const char * | pointer to the second string |
Returns: bool — true: the strings are equal; false: otherwise
lv_strdup
Duplicate a string by allocating a new one and copying the content.
char * lv_strdup(const char *src)| Name | Type | Description |
|---|---|---|
src | const char * | Pointer to the source of data to be copied. |
Returns: char * — A pointer to the new allocated string. NULL if failed.
lv_strndup
Duplicate a string by allocating a new one and copying the content up to the end or the specified maximum length, whichever comes first.
char * lv_strndup(const char *src, size_t max_len)| Name | Type | Description |
|---|---|---|
src | const char * | Pointer to the source of data to be copied. |
max_len | size_t | Maximum number of characters to be copied. |
Returns: char * — Pointer to a newly allocated null-terminated string. NULL if failed.
lv_strcat
Copies the string pointed to by src, including the terminating null character, to the end of the string pointed to by dst.
char * lv_strcat(char *dst, const char *src)| Name | Type | Description |
|---|---|---|
dst | char * | Pointer to the destination string where the content is to be appended. |
src | const char * | Pointer to the source of data to be copied. |
Returns: char * — A pointer to the destination string, which is dst.
lv_strncat
Copies up to src_len characters from the string pointed to by src to the end of the string pointed to by dst. A terminating null character is appended to dst even if no null character was encountered in src after src_len characters were copied.
char * lv_strncat(char *dst, const char *src, size_t src_len)| Name | Type | Description |
|---|---|---|
dst | char * | Pointer to the destination string where the content is to be appended. |
src | const char * | Pointer to the source of data to be copied. |
src_len | size_t | Maximum number of characters from src to be copied to the end of dst. |
Returns: char * — A pointer to the destination string, which is dst.
lv_strchr
Searches for the first occurrence of character c in the string str.
char * lv_strchr(const char *str, int c)| Name | Type | Description |
|---|---|---|
str | const char * | Pointer to the null-terminated byte string to be searched. |
c | int | The character to be searched for. |
Returns: char * — A pointer to the first occurrence of character c in the string str, or a null pointer if c is not found.
Dependencies
How is this guide?
Last updated on