Returns the string that comes right after S in alphabetical order. For example, if s is 'potato', this method will return 'potatp'. If the last character is a z, then we add to the next position, and so on.
(String s)
| 43 | * on. |
| 44 | */ |
| 45 | public static String nextString(String s) { |
| 46 | /* Handle all zs as a special case to keep helper method simple. */ |
| 47 | if (isAllzs(s)) { |
| 48 | return allAs(s.length() + 1); |
| 49 | } |
| 50 | char[] charVersion = s.toCharArray(); |
| 51 | incrementCharArray(charVersion, charVersion.length - 1); |
| 52 | return new String(charVersion); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Helper function for nextString. Increments the Pth position of X |
no test coverage detected