public final class StringUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
StringUtils.ToXMLType |
| Modifier and Type | Field and Description |
|---|---|
static Comparator<String> |
CASE_INSENSITIVE_COMPARATOR
Publicly available case-insensitive comparator.
|
static Comparator<String> |
UCS_CODEPOINT_COMPARATOR
Compares Strings based on UCS codepoint values.
|
static String |
WHITE_SPACE
Set of characters considered to be white space.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equalsWithNull(String s1,
String s2)
General-purpose string equality comparison for strings that may be
null.
|
static int |
findNoCase(CharSequence source,
CharSequence target,
int fromIndex)
Scan a string for a string, but ignore case.
|
static Comparator<String> |
getCaseInsensitiveComparator()
Return a comparator that performs case-insensitive string
comparisons.
|
static boolean |
isEmpty(CharSequence s)
Empty string test.
|
static Long |
longNumber(String s) |
static Long |
longNumber(String s,
int radix) |
static Integer |
number(String s) |
static Integer |
number(String s,
int radix) |
static String |
parseToken(StringBuilder source) |
static void |
replace(StringBuilder buf,
char find,
char rep) |
static void |
replace(StringBuilder buf,
char find,
char rep,
int start,
int limit) |
static long |
safeLongNumber(String s) |
static long |
safeLongNumber(String s,
int radix) |
static int |
safeNumber(String s) |
static int |
safeNumber(String s,
int radix) |
static int |
skipOver(CharSequence src,
String sSkip,
int nOffset)
Scan this string for the first character not in the given set.
|
static int |
skipUntil(CharSequence src,
String sSkip,
int nOffset)
Scan this string for the first character in the given set.
|
static String |
toXHTML(String sSrc,
boolean bIncludePI)
Replaces specified characters in the current string with their entity references.
|
static String |
toXML(String src,
boolean isAttribute) |
static String |
toXML(String sSrc,
StringUtils.ToXMLType eTargetType,
String sOthers,
char cRangeMin,
char cRangeMax,
String sExclude)
Replaces specified characters in the current string with their entity references.
|
static String |
trim(String s) |
static void |
trim(StringBuilder buf)
Remove white space from the end of a string buffer.
|
static String |
trimStart(String s) |
static void |
trimStart(StringBuilder buf)
Remove white space from the start of a string buffer.
|
public static final Comparator<String> CASE_INSENSITIVE_COMPARATOR
public static final Comparator<String> UCS_CODEPOINT_COMPARATOR
public static final String WHITE_SPACE
public static boolean equalsWithNull(String s1, String s2)
s1 - First string to compare.s2 - First string to compare.public static int findNoCase(CharSequence source, CharSequence target, int fromIndex)
source - the string being searched.target - the string to search for.fromIndex - the index to begin searching from.public static Comparator<String> getCaseInsensitiveComparator()
public static boolean isEmpty(CharSequence s)
s - String to be tested.public static String parseToken(StringBuilder source)
public static void replace(StringBuilder buf, char find, char rep)
public static void replace(StringBuilder buf, char find, char rep, int start, int limit)
public static int safeNumber(String s)
public static int safeNumber(String s, int radix)
public static long safeLongNumber(String s)
public static long safeLongNumber(String s, int radix)
public static int skipOver(CharSequence src, String sSkip, int nOffset)
sSkip - -
the characters to scan fornOffset - -
the position where to start the scan. Default = 0public static int skipUntil(CharSequence src, String sSkip, int nOffset)
src - -
the string to scansSkip - -
the characters to scan fornOffset - -
the position where to start the scan. Default = 0.public static void trim(StringBuilder buf)
buf - - String buffer to be trimmed.public static void trimStart(StringBuilder buf)
buf - - String buffer to be trimmed.public static String toXML(String sSrc, StringUtils.ToXMLType eTargetType, String sOthers, char cRangeMin, char cRangeMax, String sExclude)
'&' is replaced with "&"
'<' is replaced with "<"
if eTargetType = XMLTEXT
'>' is replaced with ">"
if eTargetType = XMLATTRIBUTE_WITH_DQUOTE
'"' is replaced with """
if eTargetType = XMLATTRIBUTE_WITH_QUOTE
''' is replaced with "'"
Any characters found in sOthers are replaced with entity references.
Any characters found inbetween and including the cRangeStart and cRangeEnd are
replaced with entity references.sSrc - the source string.eTargetType - an enum indicating the target xml type.sOthers - a list of characters to be encoded in this string.cRangeMin - Any characters greater than or equal to this char are encoded
with their entity references.cRangeMax - Any characters less than or equal to this char are encoded
with their entity references.sExclude - a list of characters NOT to be encoded in this string.public static String toXHTML(String sSrc, boolean bIncludePI)
elements.
'&' is replaced with "&" '<' is replaced with "<" '>' is replaced with ">"All line feeds are are replaced with
sSrc - the source string.bIncludePI - true if the string should be prefixed with .Copyright © 2010 - 2020 Adobe. All Rights Reserved