string.h

Provide string operations


Function

  char* strcpy(char *dst, char *src);
    Copy string

  char* strncpy(char *dst, char *src, int n);
    Copy string

  int strcmp(char *lhs, char *rhs);
    Compare the given string (Notice: Return 0 indicate same)

  int strncmp(char *lhs, char *rhs, int n);
    Compare the given string (Notice: Return 0 indicate same)

  char* strcat(char *dest, char *src);
    Add src to the end of dest (dest += src)

  char* index(char *s, int c);
    Return the string's substring from character c

  char* rindex(char *s, int c);
    Return the string's substring from character c

  int strlen(char *arg1);
    Return the length of string

  void* memset(void *arg1, int val, int count);
    Set the memory range to val

  void* memcpy(void *dst, void *src, int count);
    Copy memory

  int memcmp(void *lhs, void *rhs, int count);
    Compare the given two [memory, memory+count)

  char* strchr(char *s, int c);
    Searches the string pointed to by the argument str for the first occurrence of the character c (an unsigned character)

  size_t strcspn(char *s, char *charset);
    Retrieve several consecutive characters at the beginning of the string s that do not contain the characters in the string charset

  char* strncat(char *dest, char *src, size_t n);
    Appends the string pointed to by src to the end of the string pointed to by dest until n characters long

  char* strpbrk(char *s, char *charset);
    Retrieves the first character in the string s that matches the characters in the string charset, excluding the null terminator

  char* strrchr(char *s, int __c);
    Searches the string pointed to by the argument s for the position of the last occurrence of the character __c (an unsigned character)

  size_t strspn(char *s, char *charset);
    Retrieves the subscript of the first character in the string s that does not appear in the string charset

  char* strstr(char *big, char *little);
    Find the first occurrence of the string little in the string big, excluding the terminator '\0'

  char* strtok(char *str, char *sep);
    Decompose the string str into a set of strings, sep is the delimiter

  size_t strxfrm(char *dest, char *src, size_t n);
    Convert the first n characters of the string src according to LC_COLLATE in the program's current locale options and place them in the string dest

头文件

string.h

提供字符串操作函数


函数

  char* strcpy(char *dst, char *src);
    复制字符串

  char* strncpy(char *dst, char *src, int n);
    复制字符串

  int strcmp(char *lhs, char *rhs);
    计算两个字符串的标准差值(注意:等于0表示字符串一致,而非等于布尔值true)

  int strncmp(char *lhs, char *rhs, int n);
    计算两个字符串的标准差值(注意:等于0表示字符串一致,而非等于布尔值true)

  char* strcat(char *dest, char *src);
    把 src 所指向的字符串追加到 dest 所指向的字符串的结尾 (dest += src)

  char* index(char *s, int c);
    获取字符串s从第一个字符c开始的子串

  char* rindex(char *s, int c);
    获取字符串s从最后一个字符c开始的子串

  int strlen(char *arg1);
    获取字符串长度

  void* memset(void *arg1, int val, int count);
    将一段内存设置为val

  void* memcpy(void *dst, void *src, int count);
    拷贝内存

  int memcmp(void *lhs, void *rhs, int count);
    计算两个字符串的标准差值,比较count个长度

  char* strchr(char *s, int c);
    在参数 str 所指向的字符串中搜索第一次出现字符 c(一个无符号字符)的位置

  size_t strcspn(char *s, char *charset);
    检索字符串 s 开头连续有几个字符都不含字符串 charset 中的字符

  char* strncat(char *dest, char *src, size_t n);
    把 src 所指向的字符串追加到 dest 所指向的字符串的结尾,直到 n 字符长度为止

  char* strpbrk(char *s, char *charset);
    检索字符串 s 中第一个匹配字符串 charset 中字符的字符,不包含空结束字符

  char* strrchr(char *s, int __c);
    在参数 s 所指向的字符串中搜索最后一次出现字符 __c(一个无符号字符)的位置

  size_t strspn(char *s, char *charset);
    检索字符串 s 中第一个不在字符串 charset 中出现的字符下标

  char* strstr(char *big, char *little);
    在字符串 big 中查找第一次出现字符串 little 的位置,不包含终止符 '\0'

  char* strtok(char *str, char *sep);
    分解字符串 str 为一组字符串,sep 为分隔符

  size_t strxfrm(char *dest, char *src, size_t n);
    根据程序当前的区域选项中的 LC_COLLATE 来转换字符串 src 的前 n 个字符,并把它们放置在字符串 dest 中