The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
1#pragma once
2
3#include "stdint.h"
4
5/**
6 * compute the length of a null terminated string.
7 * @param str null terminated string.
8 * @return length of the string excluding the null terminator.
9 */
10size_t strlen(const char *str);
11
12/**
13 * compare two null terminated strings.
14 * @param lhs left hand side string.
15 * @param rhs right hand side string.
16 * @return negative if lhs < rhs, 0 if lhs == rhs, positive if lhs > rhs.
17 */
18int strcmp(const char *lhs, const char *rhs);
19
20/**
21 * compare two null terminated strings up to a maximum number of characters.
22 * @param lhs left hand side string.
23 * @param rhs right hand side string.
24 * @param count maximum number of characters to compare.
25 * @return negative if lhs < rhs, 0 if lhs == rhs, positive if lhs > rhs.
26 */
27int strncmp(const char *lhs, const char *rhs, size_t count);
28
29/**
30 * copy a null terminated string to a destination buffer.
31 * @param dest destination buffer.
32 * @param src source string.
33 * @return pointer to the destination buffer.
34 */
35char *strcpy(char *dest, const char *src);
36
37/**
38 * copy a null terminated string to a destination buffer up to a maximum number of characters.
39 * @param dest destination buffer.
40 * @param src source string.
41 * @param count maximum number of characters to copy.
42 * @return pointer to the destination buffer.
43 */
44char *strncpy(char *dest, const char *src, size_t count);
45
46/**
47 * convert a null terminated string to lowercase in place.
48 * @param str null terminated string to convert.
49 */
50void string_to_lower(char *str);
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.
Definition string.c:26
int strcmp(const char *s1, const char *s2)
compares the string s1 to the string s2.
Definition string.c:15
char * strcpy(char *dst, const char *src)
copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointe...
Definition string.c:42
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.
Definition string.c:55
size_t strlen(const char *s)
computes the length of the string s.
Definition string.c:3
void string_to_lower(char *str)
convert a null terminated string to lowercase in place.
Definition string.c:74