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

static LS words2_notNextToNumbers_plusApostrophe(S s) {
  new L<S> l;
  int n = l(s);
  for (int i = 0; i < n; ) {
    if (isDigit(s.charAt(i))) continue with ++i;
    int j = i;
    while (j < n && isLetterOrApostrophe(s.charAt(j)))
      ++j;
    if (j < n && isDigit(s.charAt(j))) continue with i = j;
    if (j > i) l.add(substring(s, i, j));
    while (j < n && !isLetterOrApostrophe(s.charAt(j)))
      ++j;
    i = j;
  }
  ret l;
}

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: 130 / 193
Referenced in: [show references]