public static String unquote(String s) {
if (s.startsWith("[[") && s.endsWith("]]"))
return s.substring(2, s.length()-2);
else if (s.startsWith("\"") && s.endsWith("\"") && s.length() > 1)
return s.substring(1, s.length()-1).replace("\\\"", "\"").replace("\\\\", "\\"); // SHOULD work...
else
return s; // return original
}Began life as a copy of #2000443
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: | #2000471 |
| Snippet name: | function unquote (extended for multi-line strings) |
| Eternal ID of this version: | #2000471/1 |
| Text MD5: | 77a87e406e829edba2c22a4e183c87e6 |
| Author: | stefan |
| Category: | |
| Type: | New Tinybrain snippet |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-07-30 19:45:45 |
| Source code size: | 364 bytes / 8 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 767 / 458 |
| Referenced in: | #698 - Standard Function Adder (new, developing) #2000514 - function unquote, fixed #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |