public class StringUtil
extends java.lang.Object
StringUtils
hosts a couple of utility methods around
strings.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
lineSeparator
The operating system's line separator ('\n' on UNIX, '\r\n' on Windows)
|
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Boolean |
booleanOf(java.lang.String aValue)
Returns a
Boolean object that corresponds the given value. |
static java.lang.String[] |
copy(java.lang.String[] source) |
static java.util.Map |
copyParameters(java.util.Map parameters) |
static java.lang.String |
decode(java.lang.String s) |
static java.lang.String |
encode(java.lang.String s) |
static void |
indent(java.lang.StringBuffer buffer,
int indent) |
static boolean |
isEmpty(java.lang.String value) |
static java.lang.String |
nameOf(java.lang.Class aClass)
Returns the short name of the specified class.
|
static void |
newLine(java.lang.StringBuffer buffer,
int indent) |
static java.lang.String |
packageOf(java.lang.Class aClass)
Returns the name of the package of the specified class.
|
static java.lang.String |
pathOf(java.lang.String aRoot,
java.lang.String aPath)
Returns a combination of two paths, inserting slashes as appropriate.
|
static java.lang.String |
replace(java.lang.String source,
java.lang.String pattern,
java.lang.String replace)
Replace all occurrences of a pattern within a string by a replacement
|
public static final java.lang.String lineSeparator
public static java.lang.String packageOf(java.lang.Class aClass)
aClass
- a class objectpublic static java.lang.String nameOf(java.lang.Class aClass)
aClass
- a class objectpublic static java.lang.String pathOf(java.lang.String aRoot, java.lang.String aPath)
aRoot
- a root pathaPath
- a pathpublic static java.lang.Boolean booleanOf(java.lang.String aValue)
Boolean
object that corresponds the given value.
A value of true
or yes
corresponds to
Boolean.TRUE
and a value of false
or
no
corresponds to Boolean.FALSE
.
The comparions is case-insensitive, but for performance reasons,
lower-case values of true
and false
should be used.aValue
- to value to convertpublic static java.lang.String replace(java.lang.String source, java.lang.String pattern, java.lang.String replace)
source
- The string that should be searchedpattern
- The pattern that should be replacedreplace
- The replacement that should be inserted instead of the patternpublic static void newLine(java.lang.StringBuffer buffer, int indent)
public static void indent(java.lang.StringBuffer buffer, int indent)
public static java.lang.String encode(java.lang.String s)
public static java.lang.String decode(java.lang.String s)
public static java.lang.String[] copy(java.lang.String[] source)
public static java.util.Map copyParameters(java.util.Map parameters)
public static boolean isEmpty(java.lang.String value)
Copyright © 2019 by Sucang.cn