Explanation of C-language string functions
Void * memset (void * DEST, int C, size_t count );
Set count characters before DEST to C.
Returns the value of DeST.
Void * memmove (void * DEST, const void * SRC, size_t count );
Copy count byte characters from SRC to dest. If SRC and DEST overlap, the function will automatically process the data.
Returns the value of DeST.
Void * memcpy (void * DEST, const void * SRC, size_t count );
The function of copying count byte characters from SRC to DEST is the same as that of memmove, but it cannot process the overlap between SRC and DeST.
Returns the value of DeST.
Void * memchr (const void * Buf, int C, size_t count );
Search for the position of the first occurrence of the character C in the count byte before the Buf. Find the character C or search for the Count byte, and stop searching.
If the operation succeeds, the position pointer of C appears for the first time in Buf. Otherwise, null is returned.
Void * _ memccpy (void * DEST, const void * SRC, int C, size_t count );
Copy 0 or multiple bytes from SRC to DeST. When character C is copied or count is copied, the copy is stopped.
If character C is copied, the function returns a pointer next to the character. Otherwise, null is returned.
Int memcmp (const void * buf1, const void * buf2, size_t count );
Compare the size of the first count bytes of buf1 and buf2.
Return value <0, indicating that buf1 is smaller than buf2;
The returned value is 0, indicating that buf1 is equal to buf2;
The returned value is greater than 0, indicating that buf1 is greater than buf2.
Int memicmp (const void * buf1, const void * buf2, size_t count );
Compare the Count bytes before buf1 and buf2. Unlike memcmp, It is case insensitive.
The return value is the same as the preceding one.
Size_t strlen (const char * string );
Returns the string length. null is not included in the string Terminator.
Operation error indicated by no return value.
Char * strrev (char * string );
The character order in the string is reversed. The position of the null Terminator remains unchanged.
Returns the pointer to the adjusted string.
Char * _ strupr (char * string );
Replace all lower-case letters in string with corresponding upper-case letters, and keep other characters unchanged.
Returns the pointer to the adjusted string.
Char * _ strlwr (char * string );
Replace all uppercase letters in the string with corresponding lowercase letters, and keep other characters unchanged.
Returns the pointer to the adjusted string.
Char * strchr (const char * string, int C );
Searches for the position where character C appears for the first time in string. The null Terminator is also included in the search.
Returns a pointer pointing to the first position of character C in string. If no pointer is found, null is returned.
Char * strrchr (const char * string, int C );
Searches for the position where character c Last appears in string, that is, searches for string in reverse order, including the null Terminator.
Returns a pointer pointing to the last position of character C in the string. If no pointer is found, null is returned.
Char * strstr (const char * string, const char * strsearch );
Search for strsearch substrings in string.
Returns the pointer of the first position of the substring strsearch in the string. If the substring strsearch is not found, null is returned. If the substring strsearch is empty, the function returns the string value.
Char * strdup (const char * strsource );
When the function is running, it calls the malloc function to allocate storage space for copying strsource strings, and then copies strsource to the allocated space. Note that the allocated space should be released in time.
Returns a pointer to the space allocated for the copied string. If the allocation fails, null is returned.
Char * strcat (char * strdestination, const char * strsource );
Add the source string strsource to the target string strdestination, and add the null terminator to the new string. the character of the source string strsource overwrites the end character null after the target string strdestination. there is no overflow check during string copying or adding, so make sure that the target string space is large enough. the source and target strings cannot be overlapped.
The strdestination value returned by the function.
Char * strncat (char * strdestination, const char * strsource, size_t count );
Add the Count characters starting from the source string strsource to the target string strdest. the character of the source string strsource overwrites the end character null after the target string strdestination. if count is greater than the length of the source string, the Count value is replaced with the length value of the source string. the null Terminator is automatically added to the new string. like the strcat function, this function cannot process overlapping source and target strings.
The strdestination value returned by the function.
Char * strcpy (char * strdestination, const char * strsource );
Copy the location specified by the source string strsource to the target string strdestination, including the null Terminator. The source string and target string cannot overlap.
The strdestination value returned by the function.
Char * strncpy (char * strdestination, const char * strsource, size_t count );
Copy the Count characters starting from the source string strsource to the position specified by the target string strdestination. if the Count value is less than or equal to the length of the strsource string, the null Terminator is not automatically added to the target string. When the Count value is greater than the length of the strsource string, the strsource is filled with the null terminator to count characters and copied to the target string. the source and target strings cannot be overlapped.
The strdestination value returned by the function.
Char * strset (char * string, int C );
Set all characters in the string to character C and stop the string when a null Terminator is encountered.
The function returns the adjusted string pointer to the content.
Char * strnset (char * string, int C, size_t count );
Set the start count character of string to C. If the Count value is greater than the length of string, replace the Count value with the string length.
The function returns the adjusted string pointer to the content.
Size_t strspn (const char * string, const char * strcharset );
Search for the first occurrence sequence number of any character not contained in the strcharset string (except the string Terminator null.
Returns an integer that specifies the length of a substring in string consisting of all characters in characters. If String starts with a character not contained in strcharset, the function returns 0.
Size_t strcspn (const char * string, const char * strcharset );
Searches for the sequence number of the first occurrence of any character in the strcharset string, including the string Terminator null.
Returns an integer that specifies the length of a substring in a string consisting of all characters other than characters. If the string starts with a character contained in strcharset, the function returns 0.
Char * strspnp (const char * string, const char * strcharset );
Find the first position pointer of any character not contained in the strcharset string (except the string Terminator null.
Returns a pointer to the position where the character in a non-strcharset appears for the first time in the string.
Char * strpbrk (const char * string, const char * strcharset );
Searches for the position of any character in the strcharset string that appears for the first time. It does not contain the string Terminator null.
Returns a pointer to the position where any character in strcharset appears for the first time in the string. If the two string parameters do not contain the same character, the return value is null.
Int strcmp (const char * string1, const char * string2 );
Compare the string1 and string2 strings.
Return value <0, indicating that string1 is less than string2;
The return value is 0, indicating that string1 is equal to string2;
The return value is greater than 0, indicating that string1 is greater than string2.
Int stricmp (const char * string1, const char * string2 );
Compare the sizes of string1 and string2, which are different from those of strcmp.
The returned value is the same as that of strcmp.
Int strcmpi (const char * string1, const char * string2 );
It is equivalent to the stricmp function and only provides a backward compatible version.
Int strncmp (const char * string1, const char * string2, size_t count );
Compare the string1 and string2 strings. Only the previous count characters are compared. during the comparison, if the length of any string is smaller than count, count is replaced by the length of the shorter string. at this time, if the two strings are equal to the first character, the shorter string is smaller.
Return value <0, indicating the substring of string1 smaller than string2;
The return value is 0, indicating that the substring of string1 is equal to the substring of string2;
The return value is greater than 0, indicating that the substring of string1 is greater than that of string2.
Int strnicmp (const char * string1, const char * string2, size_t count );
Compare the string1 and string2 strings with only the previous count characters. Different from strncmp, compare their lower-case letter versions.
The returned value is the same as that of strncmp.
Char * strtok (char * strtoken, const char * strdelimit );
Find the next tag in the strtoken string. The strdelimit Character Set specifies the delimit that may be encountered in the current query call.
Returns a pointer pointing to the next tag found in the strtoken. If no tag is found, null is returned. The strtoken content will be modified each time the strtoken is called, replacing each delimiter encountered with a null character.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/wully_happy/archive/2008/03/25/2216575.aspx