Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #2000331 // makeJavaStringLiteral

New Tinybrain snippet

  public static String makeJavaStringLiteral(String text) {
    if (text == null) return null;
    return "\"" + text
      .replace("\\", "\\\\")
      .replace("\"", "\\\"")
      .replace("\n", "\\n")
      .replace("\r", "\\r") + "\"";
  }

download  show line numbers   

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: 971 / 831
Referenced in: [show references]