public class StringUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EMPTY_STRING |
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
buildQualifiedReference(java.lang.String namespace,
java.lang.String value)
Builds the qualified reference value.
|
static java.lang.String |
doubleToString(double d,
int fNumber)
Converts the double value to locale-independent string representation.
|
static java.lang.String |
doubleToString(double d,
int fNumber,
ULocale locale)
Converts the double value to locale-dependent string representation.
|
static java.lang.String |
extractFileName(java.lang.String filePathName)
Extract file name (without path and suffix) from file name with path and
suffix.
|
static java.lang.String |
extractFileNameWithSuffix(java.lang.String filePathName)
Extract file name (without path but with suffix) from file name with path
and suffix.
|
static java.lang.String |
extractName(java.lang.String qualifiedName)
Extracts the name from the given qualified reference value.
|
static java.lang.String |
extractNamespace(java.lang.String qualifiedName)
Extracts the libaray namespace from the given qualified reference value.
|
static boolean |
isBlank(java.lang.String str)
Reports if a string is blank.
|
static boolean |
isEmpty(java.lang.String value)
Reports if a string is empty.
|
static boolean |
isEqual(java.lang.String str1,
java.lang.String str2)
Returns if the two string are null or equal.
|
static boolean |
isEqualIgnoreCase(java.lang.String str1,
java.lang.String str2)
Returns if the two string are null or equal.
|
static boolean |
isValidLocale(java.lang.String locale)
Check if the locale string is a valid locale format, with the language,
country and variant separated by underbars.
|
static DimensionValue |
parse(java.lang.String value)
Parses a dimension string in locale-independent way.
|
static DimensionValue |
parseInput(java.lang.String value,
ULocale locale)
Parses a dimension string in locale-dependent way.
|
static java.lang.String |
toRgbText(int rgb)
Convert an integer to an HTML RGB value.
|
static java.lang.String |
trimQuotes(java.lang.String value)
Trims the quotes.
|
static java.lang.String |
trimString(java.lang.String value)
Trim a string.
|
public static final java.lang.String EMPTY_STRING
public static java.lang.String trimString(java.lang.String value)
value
- the string to trimpublic static java.lang.String toRgbText(int rgb)
rgb
- the integer RGB valuepublic static boolean isValidLocale(java.lang.String locale)
The language argument is a valid ISO Language Code. . These codes are the lower-case, two-letter codes.
The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes.
If the language is missing, the string should begin with an underbar. (Can't have a locale with just a variant -- the variant must accompany a valid language or country code). Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
locale
- string representing a localepublic static boolean isBlank(java.lang.String str)
For example,
str
- the string to checkpublic static boolean isEmpty(java.lang.String value)
For example,
value
- the string to checkpublic static boolean isEqual(java.lang.String str1, java.lang.String str2)
java.lang.String#equals(String)
is used to compare two strings.str1
- the string to comparestr2
- the string to comparepublic static boolean isEqualIgnoreCase(java.lang.String str1, java.lang.String str2)
String.equalsIgnoreCase(String)
is used to compare two
strings.str1
- the string to comparestr2
- the string to comparepublic static java.lang.String doubleToString(double d, int fNumber)
Double.toString( double )
, and can
also handle very large number like 1.234567890E16 to "12345678900000000".d
- the double value to convertfNumber
- the positive maximum fractional numberpublic static java.lang.String doubleToString(double d, int fNumber, ULocale locale)
d
- the double value to convertfNumber
- the positive maximum fractional numberlocale
- public static DimensionValue parse(java.lang.String value) throws PropertyValueException
value
- the dimension string to parsePropertyValueException
- if the string is not validpublic static DimensionValue parseInput(java.lang.String value, ULocale locale) throws PropertyValueException
The string must match the following:
value
- the string to parselocale
- the locale where the input string residesPropertyValueException
- if the string is not validpublic static java.lang.String extractFileName(java.lang.String filePathName)
For example:
filePathName
- the file name with path and suffixpublic static java.lang.String extractFileNameWithSuffix(java.lang.String filePathName)
For example:
filePathName
- the file name with path and suffixpublic static java.lang.String extractNamespace(java.lang.String qualifiedName)
For example,
qualifiedName
- the qualified reference valuepublic static java.lang.String extractName(java.lang.String qualifiedName)
For example,
qualifiedName
- the qualified reference valuepublic static java.lang.String buildQualifiedReference(java.lang.String namespace, java.lang.String value)
For example,
namespace
- the library namespace to indicate which library the reference
is using.value
- the actual reference valuepublic static java.lang.String trimQuotes(java.lang.String value)
For example,
value
- the string may have quotesCopyright © 2014 OpenText Corp. All rights reserved.