15.4. StringCoder - Part B¶
Part b. Write the StringCoder method encodeString
. A string is encoded by determining the substrings
in the master string that can be combined to generate the given string. The encoding starts with a string part
that matches the beginning of the word, followed by a string part that matches the beginning of the rest of
the word, and so on. The string parts are returned in an array list in the order in which they appear in word.
The helper method findPart
must be used to choose matching string parts in the master string.
15.4.1. Try and Solve It¶
Complete method encodeString
below.
The code below has a main method for testing your method.
Complete method encodeString
below.
Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.