对码当歌,猿生几何?

C库:以null结尾的字符串库函数

A null-terminated byte string (NTBS) is a sequence of nonzero bytes followed by a byte with value zero (the terminating null character). Each byte in a byte string encodes one character of some character set. For example, the character array {'x63','x61','x74',''} is an NTBS holding the string "cat" in ASCII encoding.

Functions

Character classification

Defined in header <ctype.h>

isalnum

checks if a character is alphanumeric 
(function)

isalpha

checks if a character is alphabetic 
(function)

islower

checks if a character is lowercase 
(function)

isupper

checks if a character is an uppercase character 
(function)

isdigit

checks if a character is a digit 
(function)

isxdigit

checks if a character is a hexadecimal character 
(function)

iscntrl

checks if a character is a control character 
(function)

isgraph

checks if a character is a graphical character 
(function)

isspace

checks if a character is a space character 
(function)

isblank

(C99)

checks if a character is a blank character 
(function)

isprint

checks if a character is a printing character 
(function)

ispunct

checks if a character is a punctuation character 
(function)
Character manipulation

tolower

converts a character to lowercase 
(function)

toupper

converts a character to uppercase 
(function)

Note: additional functions whose names begin with either to or is, followed by a lowercase letter, may be added to the header ctype.h in future and should not be defined by programs that include that header.

Conversions to numeric formats

Defined in header <stdlib.h>

atof

converts a byte string to a floating-point value 
(function)

atoiatolatoll

(C99)

converts a byte string to an integer value 
(function)

strtolstrtoll

(C99)

converts a byte string to an integer value 
(function)

strtoulstrtoull

(C99)

converts a byte string to an unsigned integer value 
(function)

strtofstrtodstrtold

(C99)(C99)

converts a byte string to a floating point value 
(function)

Defined in header <inttypes.h>

strtoimaxstrtoumax

(C99)(C99)

converts a byte string to intmax_t or uintmax_t 
(function)
String manipulation

Defined in header <string.h>

strcpystrcpy_s

(C11)

copies one string to another 
(function)

strncpystrncpy_s

(C11)

copies a certain amount of characters from one string to another 
(function)

strcatstrcat_s

(C11)

concatenates two strings 
(function)

strncatstrncat_s

(C11)

concatenates a certain amount of characters of two strings 
(function)

strxfrm

transform a string so that strcmp would produce the same result as strcoll 
(function)
String examination

Defined in header <string.h>

strlenstrnlen_s

(C11)

returns the length of a given string 
(function)

strcmp

compares two strings 
(function)

strncmp

compares a certain amount of characters of two strings 
(function)

strcoll

compares two strings in accordance to the current locale 
(function)

strchr

finds the first occurrence of a character 
(function)

strrchr

finds the last occurrence of a character 
(function)

strspn

returns the length of the maximum initial segment that consists 
of only the characters found in another byte string 
(function)

strcspn

returns the length of the maximum initial segment that consists 
of only the characters not found in another byte string 
(function)

strpbrk

finds the first location of any character in one string, in another string 
(function)

strstr

finds the first occurrence of a substring of characters 
(function)

strtokstrtok_s

(C11)

finds the next token in a byte string 
(function)
Character array manipulation

Defined in header <string.h>

memchr

searches an array for the first occurrence of a character 
(function)

memcmp

compares two buffers 
(function)

memsetmemset_s

(C11)

fills a buffer with a character 
(function)

memcpymemcpy_s

(C11)

copies one buffer to another 
(function)

memmovememmove_s

(C11)

moves one buffer to another 
(function)
Miscellaneous

Defined in header <string.h>

strerrorstrerror_sstrerrorlen_s

(C11)(C11)

returns a text version of a given error code 
(function)