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

26
LINES

< > BotCompany Repo | #1012884 // quoteBorderless_less (leaves " as ")

JavaX fragment (include)

1  
static S quoteBorderless_less(O o) {
2  
  if (o == null) return "null";
3  
  ret quoteBorderless_less(str(o));
4  
}
5  
6  
static S quoteBorderless_less(S s) {
7  
  if (s == null) return "null";
8  
  StringBuilder out = new StringBuilder((int) (l(s)*1.5));
9  
  quoteBorderless_less_impl(s, out);
10  
  ret out.toString();
11  
}
12  
  
13  
static void quoteBorderless_less_impl(S s, StringBuilder out) {
14  
  int l = s.length();
15  
  for (int i = 0; i < l; i++) {
16  
    char c = s.charAt(i);
17  
    if (c == '\\')
18  
      out.append('\\').append(c);
19  
    else if (c == '\r')
20  
      out.append("\\r");
21  
    else if (c == '\n')
22  
      out.append("\\n");
23  
    else
24  
      out.append(c);
25  
  }
26  
}

Author comment

Began life as a copy of #1012823

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: #1012884
Snippet name: quoteBorderless_less (leaves " as ")
Eternal ID of this version: #1012884/1
Text MD5: 19812aef1c3f30bc3baa5edefb056a78
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-15 00:17:17
Source code size: 655 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 452 / 483
Referenced in: [show references]