|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.frinika.contrib.boblang.Convert
public class Convert
Text conversion and formatting methods. Each method is static.
The methods are divided into two groups:
Methods for converting and formatting values into strings are:
where:
If the number is too large to print in ddd.dd format, it will be output in exponential form.
If the total field width is too small, then the width is automatically increased
where:
If the total field width is too small, then the width is automatically increased. To format a value in the minimum number of characters, use a width of +1.
Methods for converting strings to values are:
where:
TextInput
,
TextOutput
Constructor Summary | |
---|---|
Convert()
This class only contains static methods. |
Method Summary | |
---|---|
static java.lang.String |
doubleToString(double d,
int width,
int decimal)
Convert a double to a string. |
static java.lang.String |
floatToString(float f,
int width,
int decimal)
Convert a float to a string. |
static java.lang.String |
intToString(int i,
int width)
Convert a standard integer to a string. |
static boolean |
isValidDouble(java.lang.String s)
Test if the characters in a string may be converted into a double value. |
static boolean |
isValidFloat(java.lang.String s)
Test if the characters in a string may be converted into a float value. |
static boolean |
isValidInt(java.lang.String s)
Test if the characters in a string may be converted into an integer. |
static boolean |
isValidLong(java.lang.String s)
Test if the characters in a string may be converted into a long integer. |
static boolean |
isValidShort(java.lang.String s)
Test if the characters in a string may be converted into a short integer. |
static java.lang.String |
longToString(long l,
int width)
Convert a long integer to a string. |
static java.lang.String |
shortToString(short s,
int width)
Convert a short integer to a string. |
static double |
stringToDouble(java.lang.String s,
double defaultValue)
Convert a string to a double. |
static float |
stringToFloat(java.lang.String s,
float defaultValue)
Convert a string to a float. |
static int |
stringToInt(java.lang.String s,
int defaultValue)
Convert a string to a int. |
static long |
stringToLong(java.lang.String s,
long defaultValue)
Convert a string to a long. |
static short |
stringToShort(java.lang.String s,
short defaultValue)
Convert a string to a short. |
static java.lang.String |
version()
Return the version of this class as a String |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Convert()
static
methods. There is no
need to call its constructor.
Method Detail |
---|
public static java.lang.String version()
public static java.lang.String doubleToString(double d, int width, int decimal)
Example call:
String s = Convert.doubleToString (doubleValue, width, decimal);
public static java.lang.String floatToString(float f, int width, int decimal)
Example call:
String s = Convert.floatToString (floatValue, width, decimal);
public static java.lang.String longToString(long l, int width)
Example call:
String s = Convert.longToString (longValue, width);
public static java.lang.String intToString(int i, int width)
Example call:
String s = Convert.intToString (intValue, width);
public static java.lang.String shortToString(short s, int width)
Example call:
String s = Convert.shortToString (shortValue, width);
public static boolean isValidDouble(java.lang.String s)
Example call:
boolean b = Convert.isValidDouble (digitString);
public static double stringToDouble(java.lang.String s, double defaultValue)
Example call:
double val = Convert.stringToDouble (digitString, defaultValue);
public static boolean isValidFloat(java.lang.String s)
Example call:
boolean b = Convert.isValidFloat (digitString);
public static float stringToFloat(java.lang.String s, float defaultValue)
Example call:
float val = Convert.stringToFloat (digitString, (float) defaultValue);
public static boolean isValidLong(java.lang.String s)
Example call:
boolean b = Convert.isValidLong (digitString);
public static long stringToLong(java.lang.String s, long defaultValue)
Example call:
long val = Convert.stringToLong (digitString, (long) defaultValue);
public static boolean isValidInt(java.lang.String s)
Example call:
boolean b = Convert.isValidInt (digitString);
public static int stringToInt(java.lang.String s, int defaultValue)
Example call:
int val = Convert.stringToInt (digitString, defaultValue);
public static boolean isValidShort(java.lang.String s)
Example call:
boolean b = Convert.isValidShort (digitString);
public static short stringToShort(java.lang.String s, short defaultValue)
Example call:
short val = Convert.stringToShort (digitString, (short) defaultValue);
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |