C语言字符串函数大全(国外英文资料)
C语言字符串函数大全(国外英文资料)
It's all the same -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The C language string function is large
The function name: stpcpy
Work energy: copy one string to another
Using the method: char * destin (char * source);
Application:
# include < stdio, h >
# include < string. H >
Intmain (void)
{
Charstring [10].
Char * str1 = "abcdefghi";
Stpcpy (string, str1);
Printf (" % s \ n ", string);
Return0;
}
The function name: strcat
Work energy: string splicing functions
Method: char * destin (char * source);
Application:
# include < string. H >
# include < stdio, h >
Intmain (void)
{
Chardestination [25];
A char * blank = "c =" c + + ", * Borland = "Borland";
Strcpy (destination, Borland);
Strcat (destination, blank);
Strcat (destination, c);
Printf (" % s \ n ", destination);
Return0;
}
It's a very real thing, and it's a real thing
The function name: STRCHR
Work ability: find the first match of a given character in a string
Method: char * STRCHR (char * STR, charc);
Application:
# include < string. H >
# include < stdio, h >
Intmain (void)
{
Charstring [15].
Char * PTR, c = 'r';
Strcpy (string, "Thisisastring");
PTR = STRCHR (string, c);
If (PTR)
Printf (" Thecharacter % cisatposition: % d \ n ", c, ptr-string);
The else
Printf (" Thecharacterwasnotfound \ n ");
Return0;
}
The function name: STRCMP
Work energy: crosstalk comparison
Use: intstrcmp (char * str1, char * str2);
Look at the Asic code, str1, > str2, return value >, 0; The two strings are equal, and they return 0
Application:
# include < string. H >
# include < stdio, h >
Intmain (void)
{
Char * buf1 = "aaa", * buf2 = "BBB", * buf3 = "CCC";
Intptr;
PTR = STRCMP (buf2 buf1);
If (PTR > 0)
Printf (" buffer2isgreaterthanbuffer1 \ n