Here you can find the source of quoteArg(String arg)
Parameter | Description |
---|---|
arg | The argument string |
public static String quoteArg(String arg)
//package com.java2s; /*//from w ww .jav a2 s . co m * Universal Media Server, for streaming any medias to DLNA * compatible renderers based on the http://www.ps3mediaserver.org. * Copyright (C) 2012 UMS developers. * * This program is a free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 * of the License only. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ public class Main { /** * Returns the argument string surrounded with quotes if it contains a space, * otherwise returns the string as is. * * @param arg The argument string * @return The string, optionally in quotes. */ public static String quoteArg(String arg) { if (arg != null && arg.indexOf(' ') > -1) { return "\"" + arg + "\""; } return arg; } }