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

12
LINES

< > BotCompany Repo | #1031224 // dropLeadingNewLines - does not drop them if they contain spaces

JavaX fragment (include)

1  
sS dropLeadingNewLines(S s) {
2  
  int i = 0;
3  
  while true {
4  
    if (substringAtIs(s, i, "\r\n"))
5  
      i += 2;
6  
    else if (substringAtIs(s, i, "\n"))
7  
      i++;
8  
    else
9  
      break;
10  
  }
11  
  ret substring(s, i);
12  
}

Author comment

Began life as a copy of #1026310

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031224
Snippet name: dropLeadingNewLines - does not drop them if they contain spaces
Eternal ID of this version: #1031224/2
Text MD5: 94789837d3e14050cffa50fb69b19d2d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-21 18:36:55
Source code size: 221 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 84 / 109
Version history: 1 change(s)
Referenced in: [show references]