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).

1  
static LS asteriskTok(S s) {
2  
  new LS tok;
3  
  int l = s == null ? 0 : s.length(), i = 0;
4  
  while true {
5  
    int j = i;
6  
    
7  
    while (j < l && s.charAt(j) != '*')
8  
      ++j;
9  
10  
    tok.add(substring(s, i, j));
11  
    
12  
    if ((i = j) >= l) break;
13  
    tok.add(substring(s, i, i+1));
14  
    ++i;
15  
  }
16  
  
17  
  ret tok;
18  
}

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: 89 / 131
Version history: 2 change(s)
Referenced in: [show references]