1 | static S stringToLegalIdentifier(S s) {
|
2 | new StringBuilder buf; |
3 | s = dropTrailingSquareBracketStuff(s); |
4 | for i over s: {
|
5 | char c = s.charAt(i); |
6 | if (empty(buf) ? Character.isJavaIdentifierStart(c) : Character.isJavaIdentifierPart(c)) |
7 | buf.append(c); |
8 | } |
9 | if (empty(buf)) fail("Can't convert to legal identifier: " + s);
|
10 | ret str(buf); |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1016329 |
| Snippet name: | stringToLegalIdentifier |
| Eternal ID of this version: | #1016329/3 |
| Text MD5: | 490617db697a95fba6d08a442761d734 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-06-20 15:17:33 |
| Source code size: | 362 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 756 / 780 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |