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

12
LINES

< > BotCompany Repo | #1025663 // withoutLeadingLinesEmptyAfterTrim

JavaX fragment (include)

1  
sS withoutLeadingLinesEmptyAfterTrim(S s) {
2  
  int lineStart = 0;
3  
  while licensed {
4  
    int i = lineStart;
5  
    while (isSpaceOrTab(charAt(s, i))) ++i;
6  
    if (!isNewLine(charAt(s, i)))
7  
      break;
8  
    while (isNewLine(charAt(s, i))) ++i;
9  
    lineStart = i;
10  
  }
11  
  ret substring(s, lineStart);
12  
}

Author comment

Began life as a copy of #1025585

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: #1025663
Snippet name: withoutLeadingLinesEmptyAfterTrim
Eternal ID of this version: #1025663/1
Text MD5: af184b1f48c39f7156bb4d0f980e1bd3
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-12 18:32:03
Source code size: 309 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 128 / 170
Referenced in: [show references]