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

1  
static ItIt<S> splitAtSpaceIterator(S s) {
2  
  ret iff_null(new IF0<S> {
3  
    int i = 0, l = l(s);
4  
    
5  
    public S get() {
6  
      // skip space(s)
7  
      
8  
      while (i < l) {
9  
        if (isSpaceEtc(s.charAt(i)))
10  
          ++i;
11  
        else
12  
          break;
13  
      }
14  
      
15  
      if (i >= l)
16  
        null;
17  
18  
      int j = i;
19  
      // scan for non-whitespace
20  
      while (j < l && !isSpaceEtc(s.charAt(j)))
21  
        ++j;
22  
        
23  
      S part = substring(s, i, j);
24  
      i = j;
25  
      ret part;
26  
    }
27  
  });
28  
}

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: 71 / 116
Version history: 3 change(s)
Referenced in: [show references]