Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What are the standard library functions that operate on strings in C language?
What are the standard library functions that operate on strings in C language?
1) string operation

Strcpy(p, p 1) copies the string.

Strncpy(p, p 1, n) copies a string of a specified length.

Strcat(p, p 1) additional string

Strncat(p, p 1, n) appends a string with a specified length.

Strlen(p) takes the length of the string.

Strcmp(p, p 1) comparison string

Strcasecmp ignores case comparison strings.

Strncmp(p, p 1, n) compares strings of a specified length.

Strchr(p, c) looks for the specified character in the string.

Strrchr(p, c) looks up the string in reverse.

Strstr(p, p 1) looks for a string.

Strpbrk(p, p 1) takes all the characters of the target string as a set, and looks for any element of the set in the current string.

Strspn(p, p 1) takes all the characters of the target string as a set, and finds the offset of any element that does not belong to the set in the current string.

Strcspn(p, p 1) takes all the characters of the target string as a set, and finds the offset of any element belonging to the set in the current string.

* A string handler with a specified length fills a zero terminator after the processed string.

2) Conversion from character string to numeric type

Strtod(p, ppend) converts the string p into a double value, and stores the subsequent string pointer in the char* type storage pointed by ppend.

Strotol (p, ppend, base) converts the string p into an integer value of type long, and base explicitly sets the converted integer system. If it is set to 0, the system used is judged according to a specific format. 0X, 0x prefix is interpreted as an integer in hexadecimal format, and 0 prefix is interpreted as an integer in octal format.

Atoi(p) string is converted to int integer.

Atof(p) strings are converted into double symbol points.

Atol(p) string is converted to a long integer.

3) Character checking

Isalpha () checks whether it is an alphabetic character.

Isupper () checks whether it is an uppercase character.

Islower () checks whether it is a lowercase alphabetic character.

Isdig () checks whether it is a number.

Isxdigit () checks whether it is a valid character represented by hexadecimal digits.

Isspace () checks whether it is a space type character.

Iscntrl () checks whether it is a control character.

Isfunction () checks whether it is punctuation.

Isalnum () checks letters and numbers.

Isprint () checks whether it is a printable character.

Isgraph () checks whether it is a graphic character, which is equivalent to isalnum () | ispact ().