字符串处理函数
获取字符串长度的函数
1 | #include <string.h> |
1 | #include <stdio.h> |
输出结果:
获取字符串长度可以通过如下方法:
1 | char str[100]; |
字符串拷贝函数
1 | #include <string.h> |
1 | #include <stdio.h> |
输出结果:
字符串追加函数
1 | #include <string.h> |
1 | #include <stdio.h> |
输出结果:
字符串比较函数
1 | #include <string.h> |
1 | #include <stdio.h> |
输出结果:
字符查找函数
1 | #include <string.h> |
1 | #include <stdio.h> |
输出结果:
字符串匹配函数
1 | #include <string.h> |
1 | #include <stdio.h> |
输出结果:
字符串转换数值
1 | #include <stdlib.h> |
1 | #include <stdio.h> |
输出结果:
字符串切割函数
1 | #include <string.h> |
1 | #include <stdio.h> |
输出结果:
格式化字符串操作函数
1 | #include <stdio.h> |
sprintf
和 sscanf
的基本用法:
1 | #include <stdio.h> |
输出结果:
sscanf
高级用法:
1 | #include <stdio.h> |
输出结果:
const
1 | #include <stdio.h> |
预览: