Strings
Strings handle text in your programs. Learn the C++ string class and common string operations.
Lessons
1. Intro
The Goal
2. What is a String?
Understanding string concept
3. C-style vs C++ Strings
Comparing approaches
4. The string Class
Using the string type
5. Declaring Strings
Creating string variables
6. Quiz: Text storage
Text storage
7. Quiz: String Basics
Test understanding
8. String Initialization
Giving strings content
9. Empty Strings
Strings with no content
10. String Length
Measuring string size
11. Quiz: String Properties
Test understanding
12. Accessing Characters
Getting individual letters
13. Modifying Characters
Changing individual letters
14. Bounds Checking with at
Protected character access
15. Quiz: Character Access
Test understanding
16. String Concatenation
Combining text
17. The + Operator
Combining with plus
18. The += Operator
Adding to existing strings
19. Quiz: Concatenation
Test understanding
20. Comparing Strings
Testing string relationships
21. Lexicographic Order
How strings are ordered
22. Case Sensitivity
Letter case in comparisons
23. Quiz: Comparison
Test understanding
24. String Input with cin
Reading single words
25. String Input with getline
Reading full lines
26. The Newline Problem
Handling leftover newlines
27. Quiz: String Input
Test understanding
28. Substrings
Getting portions of strings
29. Finding in Strings
Locating text
30. The npos Constant
Handling failed searches
31. Quiz: Searching
Test understanding
32. Iterating Over Strings
Processing each character
33. Range-based for Loop
Simpler character access
34. Problem - Reverse String
Flip text order
35. Problem - Count Vowels
Finding specific characters
36. Problem - Petya and Strings
Comparing two strings
37. Petya and Strings - The Idea
Convert before comparing
38. Petya and Strings - Algorithm
Breaking down the solution
39. Petya and Strings - Implementation
Complete solution
40. Lessons from Petya and Strings
summary
41. Problem - String Task
Transform and rebuild string
42. String Task - The Idea
Classify then transform
43. String Task - Algorithm
Breaking down the solution
44. String Task - Implementation
Complete solution
45. Lessons from String Task
summary
46. Section Recap
What we learned