Home > Article > Backend Development > What are string processing functions?
What is the string processing function?
String processing function (String processing function) is also called string processing function, which refers to the function used for string processing in programming languages, such as character processing in C, pascal, Visual and LotusScript. Functions for string copying, length calculation, character search, etc.
c
strcpy
Prototype: extern char *strcpy(char *dest,char *src);
Usage:# include bbed3fed50f96ac7490cfc6a498c4bc5
Function: Copy the NUL-terminated string pointed to by src to the array pointed by dest.
Returns a pointer to the character (NUL) at the end of dest.
Example:
// strcpy.c #include <syslib.h> #include <string.h> main() { char *s="Golden Global View"; char d[20]; clrscr(); strcpy(d,s); printf("%s",d); getchar(); return 0; }
strcat
Prototype: extern char *strcat(char *dest,char *src);
Usage: #include 5048b432ad0a113129300e8adb5abd47
Function: Add the string pointed to by src to the end of dest (overwrite the '\0' at the end of dest) and add '\0'.
Returns the pointer to dest.
Example:
// strcat.c #include <syslib.h> #include <string.h> main() { char d[20]="Golden Global"; char *s=" View"; clrscr(); strcat(d,s); printf("%s",d); getchar(); return 0; }
strlen
Prototype: extern int strlen(char *s);
Usage: #include bbed3fed50f96ac7490cfc6a498c4bc5
Function: Calculate the length of string s
Description: Return the length of s, excluding the terminator NULL.
Example:
// strlen.c #include <syslib.h> #include <string.h> main() { char *s="Golden Global View"; clrscr(); printf("%s has %d chars",s,strlen(s)); getchar(); return 0; }
Wait.
Recommended tutorial: c language tutorial
The above is the detailed content of What are string processing functions?. For more information, please follow other related articles on the PHP Chinese website!