public final class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static Color |
asColorHexadecimal(String token)
Returns a Color parsed from the given RGB in hexadecimal notation.
|
static Color |
asColorRGB(String token)
Returns a Color parsed from the given rgb notation.
|
static boolean |
containsCaseInsensitive(Collection<String> strings,
String string)
Returns true if the specified collection of strings contains the specified string, ignoring case.
|
static boolean |
containsWhitespace(String s)
Returns true if the specified string contains whitespace, false otherwise.
|
static String |
escapeXmlAttributeValue(String attValue)
Escape the string to be used as attribute value.
|
static String |
escapeXmlChars(String s)
Escapes the characters '<', '>' and '&' into their XML entity equivalents.
|
static Color |
findColorRGB(String token)
Returns a Color parsed from the given rgb notation.
|
static String |
formatColor(Color aColor)
Formats the specified color.
|
static String |
formatHttpDate(Date date)
Formats the specified date according to RFC 1123.
|
static int |
indexOf(String s,
char searchChar,
int beginIndex,
int endIndex)
Returns the index within the specified string of the first occurrence of
the specified search character.
|
static boolean |
isColorHexadecimal(String token)
Returns true if the specified token is an RGB in hexadecimal notation.
|
static boolean |
isColorRGB(String token)
Returns true if the specified token is in RGB notation.
|
static boolean |
isFloat(String s,
boolean trim)
Returns true if the specified string is a valid float, possibly trimming the string before checking.
|
static Date |
parseHttpDate(String s)
Parses the specified date string, assuming that it is formatted according to RFC 1123, RFC 1036 or as an ANSI
C HTTP date header.
|
public static String escapeXmlChars(String s)
StringEscapeUtils.escapeXml(String) or
StringEscapeUtils.escapeHtml(String) because those methods
escape some unicode characters as well.s - the string to escapepublic static String escapeXmlAttributeValue(String attValue)
attValue - the attribute valuepublic static boolean containsWhitespace(String s)
s - the string to check for whitespacepublic static int indexOf(String s, char searchChar, int beginIndex, int endIndex)
s - the string to searchsearchChar - the character to search forbeginIndex - the index at which to start the searchendIndex - the index at which to stop the searchpublic static boolean isFloat(String s, boolean trim)
s - the string to checktrim - whether or not to trim the string before checkingpublic static boolean containsCaseInsensitive(Collection<String> strings, String string)
strings - the strings to searchstring - the string to search forpublic static Date parseHttpDate(String s)
s - the string to parse as a datepublic static boolean isColorHexadecimal(String token)
token - the token to checkpublic static Color asColorHexadecimal(String token)
token - the token to parsepublic static boolean isColorRGB(String token)
token - the token to checkpublic static Color asColorRGB(String token)
token - the token to parsepublic static Color findColorRGB(String token)
token - the token to parsepublic static String formatColor(Color aColor)
aColor - the color to formatCopyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.