1 | static S wordAroundIndex(S s, int i) {
|
2 | if (!(i >= 0 && i < l(s) && isLetterOrDigit(s.charAt(i)))) ret ""; |
3 | int j = i; |
4 | while (i > 0 && isLetterOrDigit(s.charAt(i-1))) --i; |
5 | while (j < l(s) && isLetterOrDigit(s.charAt(j))) ++j; |
6 | ret substring(s, i, j); |
7 | } |
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: | 816 / 848 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |