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...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.