public final class StringUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
LS
Line separator as returned by System.getProperty()
|
static String |
QUOTE |
static char |
QUOTE_CHAR |
Modifier and Type | Method and Description |
---|---|
static String |
findAndStripPrefix(Set<String> prefixes,
String s) |
static String |
getMillisString(long nanos) |
static String |
getPrefix(Set<String> prefixes,
String s) |
static String |
getSecondsString(long nanos) |
static String |
getTimingString(long nanos)
Get a String representing the specified number of nanoseconds, choosing
the appropriate units based on magnitude of the value.
|
static String |
getTimingString(long nanos,
TimeUnit timeUnit) |
static List<String> |
objectNamesToStrings(Collection<ObjectName> objectNames)
Convert ObjectName into a Set of String.
|
static String[] |
objectNamesToStrings(ObjectName[] objectNames)
Convert a Set of ObjectName into a Set of String
|
static String |
quote(Object o) |
static String |
quote(Object o,
char leftHandChar) |
static String |
replaceSuffix(String s,
String fromSuffix,
String toSuffix) |
static String |
stripPrefix(String s,
String prefix) |
static String |
stripPrefixAndSuffix(String s,
String prefix,
String suffix) |
static String |
stripSuffix(String s,
String suffix) |
static String |
toHexString(byte theByte) |
static String |
toHexString(byte[] bytes) |
static String |
toHexString(byte[] bytes,
String delim) |
static String |
toLines(List<String> items) |
static String |
toString(Collection c) |
static String |
toString(Collection c,
String delim) |
static String |
toString(Object o) |
static String |
toString(String[] args) |
static String |
toString(String delim,
Object... args)
Turn an array (or varargs) set of Objects into a String
using the specified delimiter.
|
static String |
toString(String delim,
String... args) |
static <T> String[] |
toStringArray(Collection<T> c) |
static String[] |
toStringArray(Object[] items) |
static String |
upperCaseFirstLetter(String s) |
public static final char QUOTE_CHAR
public static final String QUOTE
public static final String LS
public static String toHexString(byte theByte)
public static String toHexString(byte[] bytes)
public static String stripPrefixAndSuffix(String s, String prefix, String suffix)
public static String toString(String delim, Object... args)
public static String getPrefix(Set<String> prefixes, String s)
public static String findAndStripPrefix(Set<String> prefixes, String s)
IllegalArgumentException
- if no prefix foundpublic static String getSecondsString(long nanos)
nanos
- elapsed nanosecondspublic static String getMillisString(long nanos)
nanos
- elapsed nanosecondspublic static String getTimingString(long nanos)
nanos
- elapsed nanosecondspublic static <T> String[] toStringArray(Collection<T> c)
public static String toString(Collection c, String delim)
public static String toString(Collection c)
public static List<String> objectNamesToStrings(Collection<ObjectName> objectNames)
public static String[] objectNamesToStrings(ObjectName[] objectNames)
Copyright © 2019. All rights reserved.