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

14
LINES

< > BotCompany Repo | #1008045 - words2 - deeply extract all words (and numbers) from string

JavaX fragment (include)

1  
static L<S> words2(S s) {
2  
  new L<S> l;
3  
  int n = l(s);
4  
  for (int i = 0; i < n; ) {
5  
    int j = i;
6  
    while (j < n && isLetterOrDigit(s.charAt(j)))
7  
      ++j;
8  
    if (j > i) l.add(substring(s, i, j));
9  
    while (j < n && !isLetterOrDigit(s.charAt(j)))
10  
      ++j;
11  
    i = j;
12  
  }
13  
  ret l;
14  
}

Author comment

Began life as a copy of #1007662

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1008045
Snippet name: words2 - deeply extract all words (and numbers) from string
Eternal ID of this version: #1008045/4
Text MD5: 3154ecd12a4e7b4c30cfe3c74b89c0b5
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-17 14:06:54
Source code size: 303 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 342 / 365
Version history: 3 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1008045 & http://1008045.tinybrain.de