C Medium String.h

Source: Internet
Author: User
Tags strtok

1. Function Name: strcpy
Function prototypes: Char *strcpy (char *destin, char *source);
function function: Copy a string into another string variable
function return: Address of the target string
Parameter description: Address of the Destin destination string, address of source string

2. Function Name: strncpy
Function prototypes: Char *strcpy (char *dest,char *src,int N)
function function: Takes the n characters of Src to the character array dest
function return: Address of the target string
Parameter description: Destin the address of the destination string, the address of the source string, n the number of copies to copy

3. Function Name: strcat
Function prototypes: Char *strcat (char *dest,char *src)
function function: splicing src string into string dest
function return: Address of the target string
Parameter description: Address of the Destin destination string, address of source string

4. Function Name: STRCHR
Function prototypes: Char *strchr (char *dest,char c)
function function: Finds the first match of a given character C in a string
function return: Returns a pointer to the position of the first occurrence of C, or null if no C exists
Parameter description: Destin the address of the target string, c to find the character

5. Function Name: strcmp
function prototypes: int strcmp (char *str1,char *str2)
function function: Compare two string size, case
function return: STR1>STR2 return value greater than 0, equal return 0
Parameter description: STR1 and str2 are two strings

6. Function Name: strnicmp
function prototypes: int strnicmp (char *str1,char *str2,int N)
function function: Compare the size of the first n characters of the string str1 and str2, case-insensitive
function return: STR1>STR2 return value greater than 0, equal return 0 or return value less than 0
Parameter description: ASTR1 and str2 are two strings, and N is the first few characters to compare characters str2

7. Function Name: strlen
function prototypes: int strlen (char *str)
function function: Calculate the length of a string
function return: Length of string
Parameter description: STR is the string to be computed

8. Function Name: strcspn
function prototypes: int strcspn (char *str1,char *str2)
function function: The beginning of the string str1 computes successive characters that are not in the string that the parameter str2 refers to at all. Simply put, if STRCSPN () returns a value of n, it means that the string str1 starts with n characters without the characters in the string str2.
function return: Returns the number of characters in a string str2 the beginning of the STR1
Parameter description: STR1,STR2 is a string

9. Function Name: strdup
Function prototype: Char *strdup (char *str);
function function: Copy the string to the new location
function return: Return address pointer StrDup () internally called malloc () to allocate memory for the variable, do not need to use the returned string, you need to free () the corresponding memory space, otherwise it will cause a memory leak.
Parameter description: STR is the string to be computed

10. Function Name: stricmp
Function prototype: int stricmp (char *str1,char *str2);
function function: Compare the size of two strings in case
function return: STR1>STR2 Returns a value greater than 0, equals 0 when returned, or returns a negative number
Parameter description: Str1,str2 the string to compare

11. Function Name: Strnset
Function prototypes: Char *strnset (char *str, char ch, unsigned n);
function function: Sets the first n characters of a string to the specified character
function return: The address of the string is returned
Parameter description: str to set the string, ch to set the character, n specify the number of

12. Function Name: STRPBRK
Function prototypes: Char *strpbrk (char *str1, char *str2);
function function: Compares the string str1 and str2 for the same character, and if so, returns a pointer to the position of the character in str1.
function return: A pointer that returns the position of the character in str1
Parameter description: str1 and str2 are string

13. Function Name: Strrev
Function prototype: Char *strrev (char *str);
function function: Reverses the order of all the characters in the string str.
function return: Returns a pointer to a string after the reverse order
Parameter description: STR is a string

14. Function Name: strspn
function prototypes: int strspn (const char *str1,const char *STR2)
function function: Find how many characters in the beginning of a string str1 are characters that belong to the string str2
function return: Returns the number of characters in the string str2 that are returned by the str1 at the beginning.
Parameter description: STR1 is the lookup string, str2 is the string to find

15. Function Name: strstr
function prototypes: int strspn (const char *str1,const char *STR2)
function function: Finds characters in string str1 that match exactly the characters in the STR2
The function returns: Returns a string str1 the starting address of the exact match str2 character, or null if it does not match exactly.
Parameter description: STR1 is the lookup string, str2 is the string to find

16. Function Name: strtok
Function prototypes: Char *strtok (char *str,char *s)
function function: When the string s decomposition of str string is first called, S points to the string to be decomposed, and then calls to set S to null
function return: Returns the address of a string after decomposition
Parameter description: STR is the decomposed string, S is the delimiter

C Medium String.h

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.