Videos (~1 hour)
First, we suggest that you have your students watch these videos in order, either in class or on their own time.
-
Java String Processing Overview (25 mins)
This video covers:- The basics of strings, including how to construct new strings and concatenate them together;
- How to think about strings as indexed-structures;
- Methods of the
Object
andString
classes relevant for string processing (equals,
toString
,length
,substring
,indexOf
,compareTo
).
-
numWords String Problem (20 mins)
This video covers:- How to loop over the length of a string;
- How to use the
String
'ssubstring
method to extract characters from a string; - Two different approaches to writing the same method.
wordCount
. -
HiddenWord String Problem (20 mins)
This video covers:- Solving a problem from a past AP exam;
- How to write a simple Java class;
- An example of using the
indexOf
method to help solve a problem.
Slides
These slides cover some of the material presented in the first two videos above. You could use these slides in your own lecture to replace the videos, or students could use the slides to review the content of the videos.
Lab (~1 hour)
Next, we have prepared a step-by-step lab for students to complete. This lab contains a series of problems based on material from the video, and also introduces two helpful concepts for solving string processing problems: cumulative algorithms and fencepost loops.
When a lab problem is also available on Practice-It, our code practicing website, then that problem will have a direct link to the Practice-It problem. Students can solve the problems on their own computers or on Practice-It.
Go to the string processing lab
More Practice-It problems
2014 AP CS exam
These string processing problems appeared on the 2014 Computer Science A exam:
- 1.a scrambleWord (20 mins)
- 1.b scrambleOrRemove (15 mins)
Other string processing problems
Here are a list of more string processing problems available on Practice-It. None of these problems are included in the string processing lab above.
Easier
Harder