C++ String Functions

About This Index
This page is the C++ String Functions index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn what a string is on /cpp/string. Use this page when you need a specific API such as find(), strlen(), or strcmp().
Start with find() for std::string, then strlen(), strcmp(), and strcpy() for C-string basics.
How to Call a String Function
Call std::string members with a dot; call <cstring> helpers by name:
#include <string>
#include <cstring>
std::string text = "Hello, C++!";
std::size_t pos = text.find("C++"); // member
const char* c = "Hello";
std::size_t n = std::strlen(c); // cstring
int cmp = std::strcmp(c, "Hello"); // 0 when equal C++ String Functions Table
All function guides in this C++ tutorial series (15 tutorials).
Modern C++ search
1 functionSubstring search on std::string—the preferred approach in modern C++.
Copy & concatenate
4 functionsCopy and append C-strings into char buffers.
Compare & collate
3 functionsLexicographic comparison of C-strings.
Length & character search
3 functionsMeasure length and locate characters in a C-string.
Scan & span
3 functionsSearch character sets and measure initial segments.
Diagnostics
1 functionTurn error codes into readable messages.
| Function | Description | Tutorial |
|---|---|---|
strerror() | Message for an errno error code. | Try it |
Frequently Asked Questions
Start with find()
Open the std::string search guide—syntax, examples, and FAQs.
15 people found this page helpful
