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

15
LINES

< > BotCompany Repo | #1013707 // nlToBr_withIndents

JavaX fragment (include)

1  
static S nlToBr_withIndents(S s) {
2  
  s = nlToBr(s);
3  
  new StringBuilder buf;
4  
  int i = 0;
5  
  while (i < l(s)) {
6  
    while (charAt(s, i) == ' ') {
7  
      ++i;
8  
      buf.append("&nbsp;");
9  
    }
10  
    int j = smartIndexOf(s, i, '\n')+1;
11  
    buf.append(substring(s, i, j));
12  
    i = j;
13  
  }
14  
  ret str(buf);
15  
}

Author comment

Began life as a copy of #1002851

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013707
Snippet name: nlToBr_withIndents
Eternal ID of this version: #1013707/2
Text MD5: c89f13d08f93d4df75fb97c721ba3c3c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-25 23:52:30
Source code size: 312 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 313 / 360
Version history: 1 change(s)
Referenced in: [show references]