Guided Notes

Strings

std::string basics, concatenation, length and indexing, substr and find, changing case, getline, and string streams.

std::string

Slide 1 / 5

#include <string> and use std::string for text — it grows and shrinks automatically and manages its own memory:

std::string first = "Ada"; std::string last = "Lovelace"; std::string full = first + " " + last; full += "!";

Compare with == != < > (alphabetical). Unlike C strings, there's no need to worry about the null terminator or buffer sizes.

← Operators & Booleans