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

18
LINES

< > BotCompany Repo | #1032792 // asteriskTok - only "*" is a token

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

Libraryless. Click here for Pure Java version (79L/1K).

static LS asteriskTok(S s) {
  new LS tok;
  int l = s == null ? 0 : s.length(), i = 0;
  while true {
    int j = i;
    
    while (j < l && s.charAt(j) != '*')
      ++j;

    tok.add(substring(s, i, j));
    
    if ((i = j) >= l) break;
    tok.add(substring(s, i, i+1));
    ++i;
  }
  
  ret tok;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032792
Snippet name: asteriskTok - only "*" is a token
Eternal ID of this version: #1032792/3
Text MD5: 161747ebdaaf27201c2625aadc476438
Transpilation MD5: 363b44f1088af1df2883cf2e00bed9f1
Author: stefan
Category: javax / tokenizing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-06 05:33:29
Source code size: 322 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 145 / 208
Version history: 2 change(s)
Referenced in: [show references]