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

11
LINES

< > BotCompany Repo | #1029516 // newLinesToSpaces_keepCharCount

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

Libraryless. Click here for Pure Java version (2500L/16K).

sS newLinesToSpaces_keepCharCount(S s) {
  int n = l(s);
  StringBuilder buf = new(n);
  for i to n: {
    char c = s.charAt(i);
    if (c == '\t' || c == '\r' || c == '\n')
      c = ' ';
    buf.append(c);
  }
  ret str(buf);
}

Author comment

Began life as a copy of #1014697

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029516
Snippet name: newLinesToSpaces_keepCharCount
Eternal ID of this version: #1029516/3
Text MD5: 344967ec11780375f3e4424d4e070495
Transpilation MD5: b5467ca77677946ab9c84a415ccf611f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-16 20:24:27
Source code size: 239 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 108 / 172
Version history: 2 change(s)
Referenced in: [show references]