C++ : The String Library

 

How to Include

The C string functions in the standard library are available by using

#include <string.h>


String functions

 

strlen
Returns the length of a string.
strcmp
Compares two strings. (Remember, a string is an array of characters, so you can't just use the == operator to test for equality, just as in Java). Returns 0 (i.e. false!) if the two strings are equal.
strncmp
Compares the first n characters of two strings.
strcat
Append one string on to the end of another.
strcpy
Copies a string.
strncpy
Copies the first n characters of a string.
strchr
Finds the next occurrence of a certain character in a string.
strtok
Breaks a string up into tokens. The syntax for this function is kind of strange, so be sure to read the man page.