The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
string.c File Reference
#include "string.h"

Functions

size_t strlen (const char *str)
 computes the length of the string s.
int strcmp (const char *lhs, const char *rhs)
 compares the string s1 to the string s2.
int strncmp (const char *lhs, const char *rhs, size_t count)
 compares the first n bytes of the string s1 to the first n bytes of the string s2.
char * strcpy (char *dest, const char *src)
 copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dst.
char * strncpy (char *dest, const char *src, size_t count)
 copies up to n bytes from the string pointed to by src to the buffer pointed to by dst.
void string_to_lower (char *str)
 convert a null terminated string to lowercase in place.

Function Documentation

◆ strlen()

size_t strlen ( const char * s)

computes the length of the string s.

Parameters
sthe string to compute the length of.
Returns
the length of the string s, excluding the terminating null byte ('\0').

◆ strcmp()

int strcmp ( const char * s1,
const char * s2 )

compares the string s1 to the string s2.

Parameters
s1the first string to compare.
s2the second string to compare.
Returns
an integer less than, equal to, or greater than zero if s1 is

◆ strncmp()

int strncmp ( const char * s1,
const char * s2,
size_t n )

compares the first n bytes of the string s1 to the first n bytes of the string s2.

Parameters
s1the first string to compare.
s2the second string to compare.
nthe number of bytes to compare.
Returns
an integer less than, equal to, or greater than zero if the first n

◆ strcpy()

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

copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dst.

Parameters
dstthe destination buffer.
srcthe source string to copy.
Returns
a pointer to the destination string dst.

◆ strncpy()

char * strncpy ( char * dst,
const char * src,
size_t n )

copies up to n bytes from the string pointed to by src to the buffer pointed to by dst.

Parameters
dstthe destination buffer.
srcthe source string to copy.
nthe maximum number of bytes to copy.
Returns
a pointer to the destination string dst.

◆ string_to_lower()

void string_to_lower ( char * str)

convert a null terminated string to lowercase in place.

Parameters
strnull terminated string to convert.