The C++ has a number of functions and macros that are available to work with C strings and arrays. These functions are available to use in a current program after including the header file using - #include <cstring> or #include <string.h>. All functions and macros of this header file are listed below:
Functions | Description |
memcmp() |
Compares two blocks of memory. |
strcmp() |
Compares two strings. |
strcoll() |
Compares two strings using locale. |
strncmp() |
Compare characters of two strings. |
strxfrm() |
Transform string using locale. |
Functions | Description |
strcat() |
Concatenate strings. |
strncat() |
Append characters from string. |
Functions | Description |
memchr() |
Locate character in block of memory. |
strchr() |
Searches the first occurrence of a character in a string. |
strcspn() |
Get span until character in string. |
strpbrk() |
Searches the first occurrence of any character of a string inside another string. |
strrchr() |
Searches the last occurrence of a character in a string. |
strspn() |
Get span of character set in string. |
strstr() |
Searches the first occurrence of a string inside another string. |
strtok() |
Split string into tokens. |
Functions | Description |
memset() |
Fills a block of memory. |
strerror() |
Gets pointer to error message string. |
strlen() |
Returns the length of a byte string. |
Macros | Description |
NULL |
Null pointer. |
Types | Description |
size_t |
Unsigned integer type. |