Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1030956 // getJavaLineComments

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5328L/30K).

// TODO: line comments inside of /* */ comments (super-special case)
static LS getJavaLineComments(S s) {
  ret getJavaLineComments(javaTok(s));
}

static LS getJavaLineComments(LS tok) {
  new LS out;
  for (int i = 0; i < l(tok); i += 2)
    addAll(out, regexpAllFirstGroups("//([^\r\n]*)", tok.get(i)));
  ret out;
}

Author comment

Began life as a copy of #1003572

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030956
Snippet name: getJavaLineComments
Eternal ID of this version: #1030956/7
Text MD5: 89f167666d5d8dad1ec0c894c0453520
Transpilation MD5: e58f6940c77cc8c8edca8661a11e9ce3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-07 21:54:00
Source code size: 329 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 172 / 263
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030957 - test_getJavaLineComments (OK)
#1034626 - trimmedJavaLineComments