public static String makeJavaStringLiteral(String text) { if (text == null) return null; return "\"" + text .replace("\\", "\\\\") .replace("\"", "\\\"") .replace("\n", "\\n") .replace("\r", "\\r") + "\""; }
Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
2 comment(s) hidden. show
Snippet ID: | #2000331 |
Snippet name: | makeJavaStringLiteral |
Eternal ID of this version: | #2000331/1 |
Text MD5: | b9396f44d54e82f99280ae331cf3dcd6 |
Author: | stefan |
Category: | |
Type: | New Tinybrain snippet |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-05-04 17:15:04 |
Source code size: | 252 bytes / 8 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1229 / 891 |
Referenced in: | [show references] |