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

Go to the source code of this file.

Functions

size_t strlen (const char *str)
 compute the length of a null terminated string.
int strcmp (const char *lhs, const char *rhs)
 compare two null terminated strings.
int strncmp (const char *lhs, const char *rhs, size_t count)
 compare two null terminated strings up to a maximum number of characters.
char * strcpy (char *dest, const char *src)
 copy a null terminated string to a destination buffer.
char * strncpy (char *dest, const char *src, size_t count)
 copy a null terminated string to a destination buffer up to a maximum number of characters.
void string_to_lower (char *str)
 convert a null terminated string to lowercase in place.

Function Documentation

◆ strlen()

size_t strlen ( const char * str)

compute the length of a null terminated string.

computes the length of the string s.

Parameters
strnull terminated string.
Returns
length of the string excluding the null terminator.
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 * lhs,
const char * rhs )

compare two null terminated strings.

compares the string s1 to the string s2.

Parameters
lhsleft hand side string.
rhsright hand side string.
Returns
negative if lhs < rhs, 0 if lhs == rhs, positive if lhs > rhs.
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 * lhs,
const char * rhs,
size_t count )

compare two null terminated strings up to a maximum number of characters.

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

Parameters
lhsleft hand side string.
rhsright hand side string.
countmaximum number of characters to compare.
Returns
negative if lhs < rhs, 0 if lhs == rhs, positive if lhs > rhs.
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 * dest,
const char * src )

copy a null terminated string to a destination buffer.

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

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

◆ strncpy()

char * strncpy ( char * dest,
const char * src,
size_t count )

copy a null terminated string to a destination buffer up to a maximum number of characters.

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

Parameters
destdestination buffer.
srcsource string.
countmaximum number of characters to copy.
Returns
pointer to the destination buffer.
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.