SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Functions
string.c File Reference
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for string.c:

Functions

unsigned int strlen (const char *str)
 Calculates the length of the string 'str', excluding the terminating null byte.
 
unsigned int strnlen (const char *s, unsigned int n)
 Calculates the length of the string 's', but not more than 'n' characters.
 
char * strcpy (char *dst, const char *src)
 Copies the string pointed to by 'src', including the terminating null byte, to the buffer pointed to by 'dst'.
 
char * strcat (char *dst, const char *src)
 Appends the string pointed to by 'src', including the terminating null byte, to the end of the string pointed to by 'dst'.
 
int strcmp (const char *p1, const char *p2)
 Compares the string pointed to by 'p1' to the string pointed to by 'p2'.
 
int strncmp (const char *p1, const char *p2, unsigned int cnt)
 Compares at most the first 'cnt' characters of the string pointed to by 'p1' to the string pointed to by 'p2'.
 
char * strchr (const char *s, int c)
 Finds the first occurrence of the character 'c' (converted to a char) in the string pointed to by 's', including the terminating null byte.
 
char * strrchr (const char *s, int c)
 Finds the last occurrence of the character 'c' (converted to a char) in the string pointed to by 's', including the terminating null byte.
 
char * strstr (const char *s1, const char *s2)
 Finds the first occurrence of the substring 'what' in the string 's'.
 
void * memchr (void *src, int val, unsigned int cnt)
 Locates the first occurrence of the character 'value' (converted to an unsigned char) in the first 'num' bytes of the memory area pointed to by 'ptr'.
 
char * strncpy (char *dest, const char *src, unsigned int n)
 Copies up to 'n' characters from the string pointed to by 'src', including the terminating null byte, to the buffer pointed to by 'dest'.
 
void * memmove (void *dst, const void *src, unsigned int cnt)
 Copies 'count' bytes from the memory area 'src' to the memory area 'dest'.
 

Function Documentation

◆ memchr()

void * memchr ( void *  ptr,
int  value,
unsigned int  num 
)

Locates the first occurrence of the character 'value' (converted to an unsigned char) in the first 'num' bytes of the memory area pointed to by 'ptr'.

Parameters
ptrThe input memory area.
valueThe value to search for.
numThe number of bytes to examine.
Returns
A pointer to the located character, or NULL if the character does not occur in the memory area.

◆ memmove()

void * memmove ( void *  dest,
const void *  src,
unsigned int  count 
)

Copies 'count' bytes from the memory area 'src' to the memory area 'dest'.

The memory areas may overlap.

Parameters
destThe destination memory area.
srcThe source memory area.
countThe number of bytes to copy.
Returns
A pointer to the destination memory area.

◆ strcat()

char * strcat ( char *  dst,
const char *  src 
)

Appends the string pointed to by 'src', including the terminating null byte, to the end of the string pointed to by 'dst'.

Parameters
dstThe destination string.
srcThe source string.
Returns
A pointer to the destination string.

◆ strchr()

char * strchr ( const char *  s,
int  c 
)

Finds the first occurrence of the character 'c' (converted to a char) in the string pointed to by 's', including the terminating null byte.

Parameters
sThe input string.
cThe character to search for.
Returns
A pointer to the located character, or NULL if the character does not occur in the string.

◆ strcmp()

int strcmp ( const char *  p1,
const char *  p2 
)

Compares the string pointed to by 'p1' to the string pointed to by 'p2'.

Parameters
p1The first string to compare.
p2The second string to compare.
Returns
An integer less than, equal to, or greater than zero if 'p1' is found, respectively, to be less than, to match, or be greater than 'p2'.

◆ strcpy()

char * strcpy ( char *  dst,
const char *  src 
)

Copies the string pointed to by 'src', including the terminating null byte, to the buffer pointed to by 'dst'.

Parameters
dstThe destination buffer.
srcThe source string.
Returns
A pointer to the destination buffer.

◆ strlen()

unsigned int strlen ( const char *  str)

Calculates the length of the string 'str', excluding the terminating null byte.

Parameters
strThe input string.
Returns
The length of the input string.

◆ strncmp()

int strncmp ( const char *  p1,
const char *  p2,
unsigned int  cnt 
)

Compares at most the first 'cnt' characters of the string pointed to by 'p1' to the string pointed to by 'p2'.

Parameters
p1The first string to compare.
p2The second string to compare.
cntThe maximum number of characters to compare.
Returns
An integer less than, equal to, or greater than zero if 'p1' is found, respectively, to be less than, to match, or be greater than 'p2'.

◆ strncpy()

char * strncpy ( char *  dest,
const char *  src,
unsigned int  n 
)

Copies up to 'n' characters from the string pointed to by 'src', including the terminating null byte, to the buffer pointed to by 'dest'.

Parameters
destThe destination buffer.
srcThe source string.
nThe maximum number of characters to be copied.
Returns
A pointer to the destination buffer.

◆ strnlen()

unsigned int strnlen ( const char *  s,
unsigned int  n 
)

Calculates the length of the string 's', but not more than 'n' characters.

Parameters
sThe input string.
nThe maximum number of characters to examine.
Returns
The length of the input string, but not more than 'n'.

◆ strrchr()

char * strrchr ( const char *  s,
int  c 
)

Finds the last occurrence of the character 'c' (converted to a char) in the string pointed to by 's', including the terminating null byte.

Parameters
sThe input string.
cThe character to search for.
Returns
A pointer to the located character, or NULL if the character does not occur in the string.

◆ strstr()

char * strstr ( const char *  s,
const char *  what 
)

Finds the first occurrence of the substring 'what' in the string 's'.

Parameters
sThe input string.
whatThe substring to search for.
Returns
A pointer to the beginning of the located substring, or NULL if the substring does not occur in the string.