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

16
LINES

< > BotCompany Repo | #1025876 // words2_notNextToNumbers_plusApostrophe

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

Libraryless. Click here for Pure Java version (2148L/14K).

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

Author comment

Began life as a copy of #1016974

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025876
Snippet name: words2_notNextToNumbers_plusApostrophe
Eternal ID of this version: #1025876/1
Text MD5: 79c2c564559bc863fe9f17fc92701564
Transpilation MD5: 66b75fb921c2af5702e83811f7b3b72a
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-28 10:59:35
Source code size: 454 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 248 / 346
Referenced in: [show references]