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

16
LINES

< > BotCompany Repo | #1035127 // lineStartIndexesIterator

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

Libraryless. Click here for Pure Java version (234L/2K).

static ItIt<Int> lineStartIndexesIterator(S s) {
  ret new ItIt<Int> {
    int i;
    
    public bool hasNext() {
      ret i >= 0;
    }
    
    public Int next() {
      int j = i;
      i = indexOf(s, '\n', i);
      if (i >= 0) ++i;
      ret j;
    }
  };
}

Author comment

Began life as a copy of #1005051

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035127
Snippet name: lineStartIndexesIterator
Eternal ID of this version: #1035127/1
Text MD5: 6e5ccea4b708ae0e9d7f447bd951d3e9
Transpilation MD5: 3e8916ff70eea67cbed38340ccf64f9f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-30 18:12:39
Source code size: 279 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 117 / 158
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)