StuBS
|
String functions as provided by string.h
in the C standard library.
More...
Functions | |
char * | strchrnul (const char *s, int c) |
Find the first occurrence of a character in a string. | |
char * | strchr (const char *s, int c) |
Find the first occurrence of a character in a string. | |
int | strcmp (const char *s1, const char *s2) |
Compare two strings. | |
int | strncmp (const char *s1, const char *s2, size_t n) |
Compare two strings. | |
size_t | strlen (const char *s) |
Calculate the length of a string. | |
size_t | strnlen (const char *s, size_t maxlen) |
Calculate the length of a string, limited by maxlen. | |
char * | strcpy (char *dest, const char *src) |
Copy the contents of a string including the terminating null byte (\0 ) | |
char * | strncpy (char *dest, const char *src, size_t n) |
Copy the contents of a string up to a maximum length or the terminating null byte (\0 ), whatever comes first. | |
void * | memcpy (void *__restrict__ dest, void const *__restrict__ src, size_t size) |
Copy a memory area. | |
void * | memmove (void *dest, void const *src, size_t size) |
Copy a memory area while the source may overlap with the destination. | |
void * | memset (void *dest, int pattern, size_t size) |
Fill a memory area with a pattern. | |
int | memcmp (const void *s1, const void *s2, size_t n) |
Compare a memory area. | |
String functions as provided by string.h
in the C standard library.
Find the first occurrence of a character in a string.
s | string to |
c | character to find |
Find the first occurrence of a character in a string.
s | string to |
c | character to find |
Compare two strings.
s1 | first string |
s2 | second string |
Compare two strings.
s1 | first string |
s2 | second string |
n | number of bytes to compare |
Calculate the length of a string.
s | pointer to a string |
Calculate the length of a string, limited by maxlen.
s | pointer to a string |
maxlen | upper limit of length to be returned |
Copy the contents of a string including the terminating null byte (\0
)
dest | destination string buffer |
src | source string buffer |
Copy the contents of a string up to a maximum length or the terminating null byte (\0
), whatever comes first.
dest | destination string buffer |
src | source string buffer |
n | maximum number of bytes to copy |
\0
) among the first n
bytes, the destination will not be null-terminated! void * memcpy | ( | void *__restrict__ | dest, |
void const *__restrict__ | src, | ||
size_t | size | ||
) |
Copy a memory area.
dest | destination buffer |
src | source buffer |
size | number of bytes to copy |
Copy a memory area while the source may overlap with the destination.
dest | destination buffer |
src | source buffer |
size | number of bytes to copy |
Fill a memory area with a pattern.
dest | destination buffer |
pattern | single byte pattern |
size | number of bytes to fill with pattern |
Compare a memory area.
s1 | first memory buffer |
s2 | second memory buffer |
n | number of bytes to compare |