static S quoteBorderless(O o) { if (o == null) return "null"; ret quoteBorderless(str(o)); } static S quoteBorderless(S s) { if (s == null) return "null"; StringBuilder out = new StringBuilder((int) (l(s)*1.5)); quoteBorderless_impl(s, out); ret out.toString(); } static void quoteBorderless_impl(S s, StringBuilder out) { int l = s.length(); for (int i = 0; i < l; i++) { char c = s.charAt(i); if (c == '\\' || c == '"') out.append('\\').append(c); else if (c == '\r') out.append("\\r"); else if (c == '\n') out.append("\\n"); else out.append(c); } }
Began life as a copy of #1005595
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1012823 |
Snippet name: | quoteBorderless - quote() without surrounding double quotes |
Eternal ID of this version: | #1012823/1 |
Text MD5: | f1cecf5549888474b834cf303ffdac5a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-13 23:36:58 |
Source code size: | 642 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 520 / 711 |
Referenced in: | [show references] |