lv_string.h

API reference for lv_string.h

Report on GitHub

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)
Parameters
NameTypeDescription
dstvoid *Pointer to the destination array where the content is to be copied.
srcconst void *Pointer to the source of data to be copied.
lensize_tNumber 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)
Parameters
NameTypeDescription
dstvoid *Pointer to the destination array to fill with the specified value.
vuint8_tValue to be set. The value is passed as an int, but the function fills the block of memory using the unsigned char conversion of this value.
lensize_tNumber of bytes to be set to the value.

lv_memmove

Move a block of memory from source to destination.

 
void * lv_memmove(void *dst, const void *src, size_t len)
Parameters
NameTypeDescription
dstvoid *Pointer to the destination array where the content is to be copied.
srcconst void *Pointer to the source of data to be copied.
lensize_tNumber 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)
Parameters
NameTypeDescription
p1const void *Pointer to the first memory block
p2const void *Pointer to the second memory block
lensize_tNumber 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)
Parameters
NameTypeDescription
dstvoid *pointer to the destination buffer
lensize_tnumber 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)
Parameters
NameTypeDescription
strconst 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)
Parameters
NameTypeDescription
strconst char *Pointer to byte string that is null-terminated or at least max_len bytes long.
max_lensize_tMaximum 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)
Parameters
NameTypeDescription
dstchar *Pointer to the destination array where the content is to be copied.
srcconst char *Pointer to the source of data to be copied.
dst_sizesize_tMaximum 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)
Parameters
NameTypeDescription
dstchar *Pointer to the destination array where the content is to be copied.
srcconst char *Pointer to the source of data to be copied.
dest_sizesize_tMaximum 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)
Parameters
NameTypeDescription
dstchar *Pointer to the destination array where the content is to be copied.
srcconst 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)
Parameters
NameTypeDescription
s1const char *pointer to the first string
s2const 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)
Parameters
NameTypeDescription
s1const char *pointer to the first string
s2const char *pointer to the second string
lensize_tthe 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)
Parameters
NameTypeDescription
s1const char *pointer to the first string
s2const 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)
Parameters
NameTypeDescription
srcconst 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)
Parameters
NameTypeDescription
srcconst char *Pointer to the source of data to be copied.
max_lensize_tMaximum 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)
Parameters
NameTypeDescription
dstchar *Pointer to the destination string where the content is to be appended.
srcconst 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)
Parameters
NameTypeDescription
dstchar *Pointer to the destination string where the content is to be appended.
srcconst char *Pointer to the source of data to be copied.
src_lensize_tMaximum 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)
Parameters
NameTypeDescription
strconst char *Pointer to the null-terminated byte string to be searched.
cintThe 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

Indirect dependencies

How is this guide?

Last updated on

On this page