Please enable JavaScript to use CodeHS

AP Computer Science A (Nitro)

Lesson 4.3 Developing Algorithms Using Strings

Description

In this lesson, students will learn how to develop algorithms using Strings. Students will traverse Strings using a for loop and the print.length() command.

for(int i = 0; i < string.length(); i++)
{
    String character = string.substring(i, i+1);
}

This lesson corresponds with AP Computer Science A topic 4.3.


Objective

Students will be able to:

  • Develop an algorithm using Strings
  • Find if one or more substrings has a particular property
  • Determine the number of substrings that meet specific criteria
  • Create a new string with the characters reversed