static S tok_javaDropCommentsFromWhitespace(S s) {
int l = l(s), j = 0;
new StringBuilder buf;
while (j < l) {
char c = s.charAt(j);
char d = j+1 >= l ? '\0' : s.charAt(j+1);
if (c == '/' && d == '*') {
do ++j; while (j < l && !s.substring(j, Math.min(j+2, l)).equals("*/"));
j = Math.min(j+2, l);
} else if (c == '/' && d == '/') {
do ++j; while (j < l && "\r\n".indexOf(s.charAt(j)) < 0);
} else {
buf.append(c); ++j;
}
}
ret str(buf);
}download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1008628 |
| Snippet name: | tok_javaDropCommentsFromWhitespace |
| Eternal ID of this version: | #1008628/1 |
| Text MD5: | 5da89915f1839958ee2bac02d84feead |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-05-26 14:50:28 |
| Source code size: | 513 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1054 / 1198 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1031774 - tok_whitespaceContainsJavaComments #1037247 - tok_javaDropSlashStarCommentsFromWhitespace |