public static String quote(String s) {
if (s == null) return "null";
return "\"" + s.replace("\\", "\\\\").replace("\"", "\\\"").replace("\r", "\\r").replace("\n", "\\n") + "\"";
}Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #2000442 |
| Snippet name: | function quote |
| Eternal ID of this version: | #2000442/1 |
| Text MD5: | db08ee623ad440e1d49b42af8dca603c |
| Author: | stefan |
| Category: | |
| Type: | New Tinybrain snippet |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-07-06 18:19:53 |
| Source code size: | 195 bytes / 4 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 773 / 2819 |
| Referenced in: | #698 - Standard Function Adder (new, developing) #2000564 - function quote #3000382 - Answer for ferdie (>> t = 1, f = 0) |