C++ String Functions

Last Updated:

C++ String Functions

The following are the list of inbuilt string functions in C++ programming.

FunctionsExplanation
find() Searches for a string inside a given string.
strcat() Concatenates a copy of source string to destination string and terminates destination string with a null.
strncat() Concatenates a copy of source string to destination string up to the specified length and terminates destination string with a null.
strchr() Determines the first occurrence of the given character in the given string.
strrchr() Determines the last occurrence of the given character in the given string.
strcmp() Compares the characters of two strings (This function discriminates between lower case and upper case).
strncmp() Compares the characters of two strings up to the specified length (This function discriminates between lower case and upper case).
strcoll() Compares two strings depends upon the LC_COLLATE settings.
strcpy() Copies a string from source to destination.
strncpy() Copies a string from source to destination up to the specified length.
strspn() Finds up to what length two strings are identical.
strcspn() Scans str1 for the first occurrence of any of the characters that are part of str2, returning index value of the first matched character.
strerror() Translates the error code to a suitable string that describes the error.
strlen() Determines the length of the given string.
strpbrk() Searches the first occurrence of the character in a given string and then it displays the string starting from that character.

Share this Page

Meet the Author