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

13
LINES

< > BotCompany Repo | #1000832 - bashQuote function

JavaX fragment (include)

/** possibly improvable */
static String bashQuote(String text) {
  if (text == null) return null;
  return "\"" + text
    .replace("\\", "\\\\")
    .replace("\"", "\\\"")
    .replace("\n", "\\n")
    .replace("\r", "\\r") + "\"";
}

static String bashQuote(File f) {
  ret bashQuote(f.getAbsolutePath());
}

Author comment

Began life as a copy of #1000830

download  show line numbers  debug dex   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1000832
Snippet name: bashQuote function
Eternal ID of this version: #1000832/1
Text MD5: 9ca83e09420eded8bc9329be28c31872
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-07 17:39:01
Source code size: 322 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 539 / 2709
Referenced in: [show references]

Formerly at http://tinybrain.de/1000832 & http://1000832.tinybrain.de