Here you can find the source of quoteArg(final String arg)
private static String quoteArg(final String arg)
//package com.java2s; // This code is made available under the terms of the Eclipse Public License, public class Main { private static String quoteArg(final String arg) { if (arg.indexOf(' ') > -1 || arg.indexOf('\t') > -1 || arg.indexOf('"') > -1) { if (arg.charAt(0) != '"' && (arg.charAt(arg.length() - 1) != '"')) { StringBuilder sb = new StringBuilder(); sb.append("\""); //$NON-NLS-1$ sb.append(arg.replace("\"", "\"\"")); //$NON-NLS-1$ //$NON-NLS-2$ sb.append("\""); //$NON-NLS-1$ return sb.toString(); }/*from w w w. j a v a 2 s .c o m*/ } return arg; } }