C 标准库 - string.h

  • This header file defines several functions to manipulate C strings and arrays.
  • string .h 头文件定义了一个变量类型、一个宏和各种操作字符数组的函数。

库变量

size_t

  • Unsigned integral type (type )
  • 这是无符号整数类型,它是 sizeof 关键字的结果。

库宏

NULL

  • Null pointer
  • 这个宏是一个空指针常量的值。

库函数

void *memchr(const void *str, int c, size_t n)
//在参数 str 所指向的字符串的前 n 个字节中搜索第一次出现字符 c(一个无符号字符)的位置。 int memcmp(const void *str1, const void *str2, size_t n)
//把 str1 和 str2 的前 n 个字节进行比较。 void *memcpy(void *dest, const void *src, size_t n)
//从 src 复制 n 个字符到 dest。 void *memmove(void *dest, const void *src, size_t n)
//另一个用于从 str2 复制 n 个字符到 str1 的函数。 void *memset(void *str, int c, size_t n)
//复制字符 c(一个无符号字符)到参数 str 所指向的字符串的前 n 个字符。 char *strcat(char *dest, const char *src)
//把 src 所指向的字符串追加到 dest 所指向的字符串的结尾。 char *strncat(char *dest, const char *src, size_t n)
//把 src 所指向的字符串追加到 dest 所指向的字符串的结尾,直到 n 字符长度为止。 char *strchr(const char *str, int c)
//在参数 str 所指向的字符串中搜索第一次出现字符 c(一个无符号字符)的位置。 int strcmp(const char *str1, const char *str2)
//把 str1 所指向的字符串和 str2 所指向的字符串进行比较。 int strncmp(const char *str1, const char *str2, size_t n)
//把 str1 和 str2 进行比较,最多比较前 n 个字节。 int strcoll(const char *str1, const char *str2)
//把 str1 和 str2 进行比较,结果取决于 LC_COLLATE 的位置设置。 char *strcpy(char *dest, const char *src)
//把 src 所指向的字符串复制到 dest。 char *strncpy(char *dest, const char *src, size_t n)
//把 src 所指向的字符串复制到 dest,最多复制 n 个字符。 size_t strcspn(const char *str1, const char *str2)
//检索字符串 str1 开头连续有几个字符都不含字符串 str2 中的字符。
char *strerror(int errnum)
//从内部数组中搜索错误号 errnum,并返回一个指向错误消息字符串的指针。 size_t strlen(const char *str)
//计算字符串 str 的长度,直到空结束字符,但不包括空结束字符。 char *strpbrk(const char *str1, const char *str2)
//检索字符串 str1 中第一个匹配字符串 str2 中字符的字符,不包含空结束字符。也就是说,依次检验字符串 str1 中的字符,当被检验字符在字符串 str2 中也包含时,则停止检验,并返回该字符位置。 char *strrchr(const char *str, int c)
//在参数 str 所指向的字符串中搜索最后一次出现字符 c(一个无符号字符)的位置。 size_t strspn(const char *str1, const char *str2)
//检索字符串 str1 中第一个不在字符串 str2 中出现的字符下标。 char *strstr(const char *haystack, const char *needle)
//在字符串 haystack 中查找第一次出现字符串 needle(不包含空结束字符)的位置。 char *strtok(char *str, const char *delim)
//分解字符串 str 为一组字符串,delim 为分隔符。 size_t strxfrm(char *dest, const char *src, size_t n)
//根据程序当前的区域选项中的 LC_COLLATE 来转换字符串 src 的前 n 个字符,并把它们放置在字符串 dest 中。

文章参考

转载注明出处

C 标准库 - string.h的更多相关文章

  1. C标准库<string.h>实现

    本文地址:http://www.cnblogs.com/archimedes/p/c-library-string.html,转载请注明源地址. 1.背景知识 <string.h>中声明的 ...

  2. C标准库string.h中几个常用函数的使用详解

    strlen 计算字符串长度 size_t strlen(const char *str) 计算字符串 str 的长度,直到空结束字符,但不包括空结束字符. 函数实现: int Strlen(cons ...

  3. C 标准库 - string.h之memmove使用

    memmove Move block of memory Copies the values of num bytes from the location pointed by source to t ...

  4. C 标准库 - string.h之memcpy使用

    memcpy Copy block of memory Copies the values of num bytes from the location pointed to by source di ...

  5. C 标准库 - string.h之memcmp使用

    memcmp Compare two blocks of memory. Compares the first num bytes of the block of memory pointed by ...

  6. C 标准库 - string.h之memchr使用

    memchr Locate character in block of memory,Searches within the first num bytes of the block of memor ...

  7. C 标准库 - string.h之strlen使用

    strlen Returns the length of the C string str. The length of a C string is determined by the termina ...

  8. C 标准库 - string.h之strpbrk使用

    strpbrk Locate characters in string,Returns a pointer to the first occurrence in str1 of any of the ...

  9. C 标准库 - string.h之strrchr使用

    strrchr Locate last occurrence of character in string, Returns a pointer to the last occurrence of c ...

随机推荐

  1. Mac OS X Yosemite & Arduino安装CH340 USB转串口驱动

    新买的Arduino开发板 USB转串口使用了CH340芯片,在Mac OS X Yosemite上正常安装驱动后,在Arduino IDE的端口没发现相应的设备,使用以下方法后就能使用USB转串口调 ...

  2. [LeetCode 题解]: Minimum Depth of Binary Tree

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...

  3. win7 64 VC++ ado方式连接access 连接字符串

    运行环境:win7 64       vc++6.0       office 2007  32位(access 2007) 我用的是ado方式连接access数据库,(现在的Win7系统中安装的一般 ...

  4. Dapper扩展Dapper.Common框架 Linq To Sql 底层源码.net ORM框架

    源代码:https://github.com/1448376744/Dapper.CommonNUGET: Dapper.CommonQQ群:642555086 一.基本结构,此处可用委托,或动态代理 ...

  5. c# 类的反射实例 (GetType().Invoke().GetMethod().CreateInstance())

    原文:http://www.cnblogs.com/chenwei19/archive/2009/02/04/1384034.html Class1和Form 窗体在同一个命名空间 using Sys ...

  6. .net 抽象类(abstract)和接口(interface)区别

    1.抽象类    (1) 抽象方法只作声明,而不包含实现,可以看成是没有实现体的虚方法    (2) 抽象类不能被实例化    (3) 抽象类可以但不是必须有抽象属性和抽象方法,但是一旦有了抽象方法, ...

  7. “全栈2019”Java第六十九章:内部类访问外部类成员详解

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  8. php-fpm 解析

    以下内容转自:https://blog.csdn.net/u010785091/article/details/78705690 有一些工具一直在用,却从来也不知道这些东西是什么. 现在想想还是梳理一 ...

  9. 编译的 Ruby 2.3.0 缺少 openssl 支持的解决方法 (已解决)

    我的系统是centos 7.5,已离线安装ruby-2.3.0,openssl-1.0.2l,rubygems-2.7.4 如下图: 但是在  gem sources -a http://gems.r ...

  10. [转] 迁移 VMware 虚拟机到 KVM

    迁移 VMware 虚拟机到 KVM 如何迁移 VMware 上的 Windows 及 Linux 虚拟机到基于 KVM 的虚拟机 目前 x86 平台上最流行的虚拟化软件是 VMware 公司的系列产 ...