Three String Exercises

February 12, 2016

We have three simple exercises on strings today:

  1. Write a function that determines the length of a string.
  2. Write a function that finds the index of the first occurrence of a character in a string, optionally starting at a given index.
  3. Write a function that creates a new string as a substring of an input string, from a given starting index to a given ending index.

Your task is to write the three exercises described above. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2