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

28
LINES

< > BotCompany Repo | #1035764 // splitAtSpaceIterator

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

Libraryless. Click here for Pure Java version (9293L/51K).

static ItIt<S> splitAtSpaceIterator(S s) {
  ret iff_null(new IF0<S> {
    int i = 0, l = l(s);
    
    public S get() {
      // skip space(s)
      
      while (i < l) {
        if (isSpaceEtc(s.charAt(i)))
          ++i;
        else
          break;
      }
      
      if (i >= l)
        null;

      int j = i;
      // scan for non-whitespace
      while (j < l && !isSpaceEtc(s.charAt(j)))
        ++j;
        
      S part = substring(s, i, j);
      i = j;
      ret part;
    }
  });
}

Author comment

Began life as a copy of #1028697

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035764
Snippet name: splitAtSpaceIterator
Eternal ID of this version: #1035764/4
Text MD5: 72b5ac857aa1578d4437a518708b1dca
Transpilation MD5: 39b1d43195e1cf95bb47cd11cc6ecd3b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-20 03:10:51
Source code size: 528 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 127 / 190
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)