Strings

Strings handle text in your programs. Learn the C++ string class and common string operations.

46 lessons
184 min

Lessons

1. Intro

The Goal

4m

2. What is a String?

Understanding string concept

4m

3. C-style vs C++ Strings

Comparing approaches

4m

4. The string Class

Using the string type

4m

5. Declaring Strings

Creating string variables

4m

6. Quiz: Text storage

Text storage

3m1 problems

7. Quiz: String Basics

Test understanding

3m1 problems

8. String Initialization

Giving strings content

4m

9. Empty Strings

Strings with no content

4m

10. String Length

Measuring string size

4m

11. Quiz: String Properties

Test understanding

3m1 problems

12. Accessing Characters

Getting individual letters

4m

13. Modifying Characters

Changing individual letters

4m

14. Bounds Checking with at

Protected character access

4m

15. Quiz: Character Access

Test understanding

3m1 problems

16. String Concatenation

Combining text

4m

17. The + Operator

Combining with plus

4m

18. The += Operator

Adding to existing strings

4m

19. Quiz: Concatenation

Test understanding

3m1 problems

20. Comparing Strings

Testing string relationships

4m

21. Lexicographic Order

How strings are ordered

4m

22. Case Sensitivity

Letter case in comparisons

4m

23. Quiz: Comparison

Test understanding

3m1 problems

24. String Input with cin

Reading single words

4m

25. String Input with getline

Reading full lines

4m

26. The Newline Problem

Handling leftover newlines

4m

27. Quiz: String Input

Test understanding

3m1 problems

28. Substrings

Getting portions of strings

4m

29. Finding in Strings

Locating text

4m

30. The npos Constant

Handling failed searches

4m

31. Quiz: Searching

Test understanding

3m1 problems

32. Iterating Over Strings

Processing each character

4m

33. Range-based for Loop

Simpler character access

4m

34. Problem - Reverse String

Flip text order

4m1 problems

35. Problem - Count Vowels

Finding specific characters

4m1 problems

36. Problem - Petya and Strings

Comparing two strings

4m1 problems

37. Petya and Strings - The Idea

Convert before comparing

4m

38. Petya and Strings - Algorithm

Breaking down the solution

5m

39. Petya and Strings - Implementation

Complete solution

7m1 problems

40. Lessons from Petya and Strings

summary

4m

41. Problem - String Task

Transform and rebuild string

4m1 problems

42. String Task - The Idea

Classify then transform

4m

43. String Task - Algorithm

Breaking down the solution

4m

44. String Task - Implementation

Complete solution

7m1 problems

45. Lessons from String Task

summary

4m

46. Section Recap

What we learned

5m

Ready to start learning?

Access all 46 lessons with interactive content and progress tracking.