Your Turn: Create a Modified String
Now that we can concatenate strings with + and access substrings, let’s make a project that starts with “Have a nice day.” and uses parts of it to create “Have a GREAT day!” It’s the equivalent of substituting “GREAT” in place of “nice” and “!” in place of “.”
As you work with this project, keep in mind that the original string “Have a nice day.” was never changed. A new string was created using parts of the original and then assigned equal to s, redefining s.
Example project: string_surgery_your_turn
- Enter and name string_surgery_your_turn.
- Click the Download button.
- Check the results in the serial terminal.
- Verify that the original is “Have a nice day.” and the modified is “Have a GREAT day!”