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

15
LINES

< > BotCompany Repo | #1013707 // nlToBr_withIndents

JavaX fragment (include)

static S nlToBr_withIndents(S s) {
  s = nlToBr(s);
  new StringBuilder buf;
  int i = 0;
  while (i < l(s)) {
    while (charAt(s, i) == ' ') {
      ++i;
      buf.append("&nbsp;");
    }
    int j = smartIndexOf(s, i, '\n')+1;
    buf.append(substring(s, i, j));
    i = j;
  }
  ret str(buf);
}

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: 379 / 430
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)