|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.util.UString
public final class UString
A collection of static methods that are related to strings and formatting.
Field Summary | |
---|---|
static java.lang.String |
NAN_STRING
|
static java.lang.String |
NAN_STRING_ALT
|
static java.lang.String |
NEGINF_STRING
|
static java.lang.String |
POSINF_STRING
|
static java.lang.String |
SIGPOSINF_STRING
|
Constructor Summary | |
---|---|
UString()
|
Method Summary | |
---|---|
static java.lang.String |
capitalizeFirst(java.lang.String s)
Resturns string with first characted capitalized, rest lowercase. |
static java.lang.String |
formatNumber(double number,
java.text.NumberFormat format,
int precision)
Formats number with format if
format ! |
static java.lang.Double |
parseToNumber(java.lang.String text)
Parses a given string to a Double if possible and returns
it. |
static java.lang.String |
replaceAllSubStrings(java.lang.String origString,
java.lang.String substring,
java.lang.String replacementString)
This method replaces all occurences of a substring in an
original string with a replacement string. |
static java.lang.String |
replaceSubString(java.lang.String origString,
java.lang.String substring,
java.lang.String replacementString)
This method replaces the first occurence of a substring in an original string with a replacement string. |
static java.lang.String |
replaceSubString(java.lang.String origString,
java.lang.String substring,
java.lang.String replacementString,
int pos)
This method replaces the first occurence of a substring in an original string with a replacement string, starting from a given position. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NAN_STRING
public static final java.lang.String NAN_STRING_ALT
public static final java.lang.String POSINF_STRING
public static final java.lang.String SIGPOSINF_STRING
public static final java.lang.String NEGINF_STRING
Constructor Detail |
---|
public UString()
Method Detail |
---|
public static java.lang.String formatNumber(double number, java.text.NumberFormat format, int precision)
number
with format
if
format != null
. Otherwise return number
as
a string. The formatter respects the given precision
.
number
- the double
to formatformat
- the formatter, can be null
precision
- number of digits right to the decimal point
number
public static java.lang.Double parseToNumber(java.lang.String text)
Double
if possible and returns
it. NaN, (+)Infinity, and -Infinity,
are recognized. If
the given string is empty, NaN
is returned.
text
- a string that should represent a number, scientific notation
is recognized as well
Double
or null
if
something went wrong
java.lang.IllegalArgumentException
- if (text == null)
public static java.lang.String replaceAllSubStrings(java.lang.String origString, java.lang.String substring, java.lang.String replacementString)
substring
in an
original string with a replacement string. It does not work with regular
expressions.
origString
- the string to work onsubstring
- must occur completely in origString
for the
replacement to workreplacementString
- the string with which substring
is replaced
origString
if any of the parameters is
null
, if substring
is empty or if
substring
does not occur in
origString
public static java.lang.String replaceSubString(java.lang.String origString, java.lang.String substring, java.lang.String replacementString)
origString
- the string to work onsubstring
- must occur completely in origString
for the
replacement to workreplacementString
- the string with which substring
is replaced
origString
if any of the parameters is
null
, if substring
is empty or if
substring
does not occur in
origString
public static java.lang.String replaceSubString(java.lang.String origString, java.lang.String substring, java.lang.String replacementString, int pos)
origString
- the string to work onsubstring
- must occur completely in origString
for the
replacement to workreplacementString
- the string with which substring
is replacedpos
- the index in origString
to start searching for
substring
, if < 0 pos
is set
to 0
origString
if any of the parameters is
null
, if substring
is empty or if
substring
does not occur in
origString
or if
pos >= origString.length()
public static java.lang.String capitalizeFirst(java.lang.String s)
s
-
null
if s == null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |