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

13
LINES

< > BotCompany Repo | #1000832 // bashQuote function

JavaX fragment (include)

1  
/** possibly improvable */
2  
static String bashQuote(String text) {
3  
  if (text == null) return null;
4  
  return "\"" + text
5  
    .replace("\\", "\\\\")
6  
    .replace("\"", "\\\"")
7  
    .replace("\n", "\\n")
8  
    .replace("\r", "\\r") + "\"";
9  
}
10  
11  
static String bashQuote(File f) {
12  
  ret bashQuote(f.getAbsolutePath());
13  
}

Author comment

Began life as a copy of #1000830

download  show line numbers  debug dex  old transpilations   

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

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