public class StrUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static char[] |
HEX_DIGITS |
| 构造器和说明 |
|---|
StrUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
appendEscapedTextToBuilder(StringBuilder out,
String item,
char separator)
writes chars from item to out, backslash escaping as needed based on separator --
but does not append the separator itself
|
static String |
escapeTextWithSeparator(String item,
char separator)
Creates a new copy of the string with the separator backslash escaped.
|
static String |
formatString(String pattern,
Object... args)
Format using
MessageFormat but with the ROOT locale |
static String |
join(Collection<?> items,
char separator)
Creates a backslash escaped string, joining all the items.
|
static boolean |
parseBool(String s)
how to transform a String into a boolean... more flexible than
Boolean.parseBoolean() to enable easier integration with html forms.
|
static boolean |
parseBool(String s,
boolean def)
|
static boolean |
parseBoolean(String s)
Return if a string starts with '1', 't', or 'T'
and return false otherwise.
|
static void |
partialURLEncodeVal(Appendable dest,
String val)
URLEncodes a value, replacing only enough chars so that
the URL may be unambiguously pasted back into a browser.
|
static List<String> |
split(String s,
char sep) |
static List<String> |
splitFileNames(String fileNames)
Splits file names separated by comma character.
|
static List<String> |
splitSmart(String s,
char separator) |
static List<String> |
splitSmart(String s,
char separator,
boolean trimEmpty) |
static void |
splitSmart(String s,
char separator,
List<String> lst)
Split a string based on a separator, but don't split if it's inside
a string.
|
static List<String> |
splitSmart(String s,
String separator,
boolean decode)
Splits a backslash escaped string on the separator.
|
static List<String> |
splitWS(String s,
boolean decode) |
static List<String> |
toLower(List<String> strings) |
public static void splitSmart(String s, char separator, List<String> lst)
public static List<String> splitSmart(String s, String separator, boolean decode)
Current backslash escaping supported:
\n \t \r \b \f are escaped the same as a Java String
Other characters following a backslash are produced verbatim (\c => c)
s - the string to splitseparator - the separator to split ondecode - decode backslash escapingpublic static List<String> splitFileNames(String fileNames)
fileNames - the string containing file namespublic static String join(Collection<?> items, char separator)
public static boolean parseBoolean(String s)
public static boolean parseBool(String s)
public static boolean parseBool(String s, boolean def)
public static void partialURLEncodeVal(Appendable dest, String val) throws IOException
Characters with a numeric value less than 32 are encoded. &,=,%,+,space are encoded.
IOExceptionpublic static String escapeTextWithSeparator(String item, char separator)
public static void appendEscapedTextToBuilder(StringBuilder out, String item, char separator)
public static String formatString(String pattern, Object... args)
MessageFormat but with the ROOT localeCopyright © 2006–2022 The Apache Software Foundation. All rights reserved.