static S wordAroundIndex(S s, int i) { if (!(i >= 0 && i < l(s) && isLetterOrDigit(s.charAt(i)))) ret ""; int j = i; while (i > 0 && isLetterOrDigit(s.charAt(i-1))) --i; while (j < l(s) && isLetterOrDigit(s.charAt(j))) ++j; ret substring(s, i, j); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007430 |
| Snippet name: | wordAroundIndex - find word at character index |
| Eternal ID of this version: | #1007430/8 |
| Text MD5: | b1df1253da68acfacaa705fea31c6fe8 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-12-06 23:43:28 |
| Source code size: | 265 bytes / 7 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 814 / 846 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |