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

14
LINES

< > BotCompany Repo | #1025782 // words2_plusApostrophe - deeply extract all words (and numbers) from string

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

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

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

Author comment

Began life as a copy of #1008045

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: #1025782
Snippet name: words2_plusApostrophe - deeply extract all words (and numbers) from string
Eternal ID of this version: #1025782/1
Text MD5: a6fa7bb426cb9195b7346d70da9d5951
Transpilation MD5: a945681a3c03927a29423ad4d2d32022
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-19 19:29:29
Source code size: 340 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 224 / 321
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)