public class StringUtils
extends java.lang.Object
构造器和说明 |
---|
StringUtils() |
限定符和类型 | 方法和说明 |
---|---|
static java.lang.String |
fixFileSeparatorChar(java.lang.String arg)
Fixes the file separator char for the target platform
using the following replacement.
'/' File.separatorChar
'\\' File.separatorChar
|
static boolean |
isQuoted(java.lang.String argument)
Determines if this is a quoted argument - either single or
double quoted.
|
static java.lang.String |
quoteArgument(java.lang.String argument)
Put quotes around the given String if necessary.
|
static java.lang.String[] |
split(java.lang.String input,
java.lang.String splitChar)
Split a string into an array of strings based
on a separator.
|
static java.lang.StringBuffer |
stringSubstitution(java.lang.String argStr,
java.util.Map vars,
boolean isLenient)
Perform a series of substitutions.
|
static java.lang.String |
toString(java.lang.String[] strings,
java.lang.String separator)
Concatenates an array of string using a separator.
|
public static java.lang.StringBuffer stringSubstitution(java.lang.String argStr, java.util.Map vars, boolean isLenient)
argStr
- the argument string to be processedvars
- name/value pairs used for substitutionisLenient
- ignore a key not found in vars or throw a RuntimeException?public static java.lang.String[] split(java.lang.String input, java.lang.String splitChar)
input
- what to splitsplitChar
- what to split onpublic static java.lang.String fixFileSeparatorChar(java.lang.String arg)
arg
- the argument to fixpublic static java.lang.String toString(java.lang.String[] strings, java.lang.String separator)
strings
- the strings to concatenateseparator
- the separator between two stringspublic static java.lang.String quoteArgument(java.lang.String argument)
If the argument doesn't include spaces or quotes, return it as is. If it contains double quotes, use single quotes - else surround the argument by double quotes.
argument
- the argument to be quotedjava.lang.IllegalArgumentException
- If argument contains both types of quotespublic static boolean isQuoted(java.lang.String argument)
argument
- the argument to check