The Final Result

Top  Previous  Next

Here's the final result of the 2 refactorings plus the small tweaks. See if you think it is better code than we started with (and then imagine that you have a 150-line routine that you have to debug, and whether isolating different chunks of logic into different subroutines - in a fast, error-free, mostly automatic manner - could help your maintenance efforts). Also, notice that you have two new routines - positionOfLastDelimiter and lastDelimitedStringBeforePosition - which are potentially useful in other contexts.

 

lastWord8