// credits to stackoverflow.com/users/1442960/marcus static S lexicographicallyNextString(S input) { final int lastCharPosition = input.length()-1; String inputWithoutLastChar = input.substring(0, lastCharPosition); char lastChar = input.charAt(lastCharPosition); char incrementedLastChar = (char) (lastChar + 1); // Handle int/char overflow. This wasn't done above. if (incrementedLastChar == ((char) 0)) return input+incrementedLastChar; return inputWithoutLastChar+incrementedLastChar; }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004368 |
Snippet name: | lexicographicallyNextString |
Eternal ID of this version: | #1004368/1 |
Text MD5: | b009d1bcfc20da6a4f4aacea582521d7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-14 15:53:43 |
Source code size: | 514 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 558 / 548 |
Referenced in: | [show references] |