char *strcpy(char *s1, const char *s2) char *strncpy(char *s1, const char *s2, size_t n) char *strcat(char *s1, const char *s2) char *strncat(char *s1, const char *s2, size_t n) char *strstr(const char *str1, const char *str2) 实现从字符串str1中查找是否存在子字符串str2,如果有,从str1中的str2位置起,返回str1中str2起始位置的指针,如果没有,返回null int strcmp(const char *s1, const char *s2) 比较字符串s1和字符串s2。函数在s1等于、小于或大于s2时分别返回0、小于0或者大于0的值 int strncmp(const char *s1, const char *s2, size_t n) size_t strlen(const char *s) void *memset(void *s,int c,size_t n) 将已开辟内存空间 s 的首 n 个字节的值设为值 c,用来对一段内存空间全部设置为某个字符,一般用在对定义的字符串进行初始化为' ’或'/0’;例:char a[100];memset(a, '/0', sizeof(a)); 使用示例: #include <iostream> using namespace std; int main() |
|
来自: susongdada > 《CS》