One, string copy function
①strcpy
strcpy (char *s1,char *s2)
Copies the string pointed to by S2 to the array S1 points to, and if S1 and S2 have overlapping memory spaces, do undefined processing and return the value of S1.
②strncpy
strncpy (char *s1,char *s2,n)
Copies the string pointed to by S2 to the array pointed to by S1, and if the length of S2 is greater than or equal to N, it is copied to the nth character, otherwise the remainder is filled with a null character. If the memory space that S1 and S2 point to overlap, do undefined processing, return the value of S1.
Second, string concatenation function
①strcat
strcat (char *s1,char *s2)
The string pointed to by the S2 is concatenated to the end of the array pointed to by S1, and if S1 and S2 have overlapping memory spaces, undefined processing is done, returning the value of S1.
②strncat
strcat (char *s1,char *s2,n)
The string pointed to by S2 is concatenated to the end of the array pointed to by S1, and if the length of the S2 is greater than or equal to N, the truncation is exceeded. If the memory space that S1 and S2 point to overlap, do undefined processing, return the value of S1.
Three, string comparison function
①strcmp
strcmp (char *s1,char *s2)
Compare the size of the string that S1 points to and the string array that S2 points to (compare one by one)
②strncmp
strcmp (char *s1,char *s2,n)
Compares the size of a specified n character to a string array that S1 points to and S2 (compare by comparison)
Four, string conversion function
①atoi
Convert string to int integer
②atol
Convert a string to a long integer
③atof
Converts a string to a double floating-point type
V. Get the length of the specified string
①strlen
strlen (char *s1)
C Language String processing function