1 | static void quoteToPrintWriter(S s, PrintWriter out) {
|
2 | if (s == null) { out.print("null"); ret; }
|
3 | out.print('"');
|
4 | int l = s.length(); |
5 | for (int i = 0; i < l; i++) {
|
6 | char c = s.charAt(i); |
7 | if (c == '\\' || c == '"') {
|
8 | out.print('\\'); out.print(c);
|
9 | } else if (c == '\r') |
10 | out.print("\\r");
|
11 | else if (c == '\n') |
12 | out.print("\\n");
|
13 | else if (c == '\0') |
14 | out.print("\\0");
|
15 | else |
16 | out.print(c); |
17 | } |
18 | out.print('"');
|
19 | } |
Began life as a copy of #1005595
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1005966 |
| Snippet name: | quoteToPrintWriter |
| Eternal ID of this version: | #1005966/2 |
| Text MD5: | df90ff15f6409cca33c821bbf89755db |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-06-02 23:58:03 |
| Source code size: | 484 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 858 / 1054 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |