public class StringConverter
extends java.lang.Object
booleanintlongfloatdoubleorg.eclipse.swt.graphics.Pointorg.eclipse.swt.graphics.Rectangleorg.eclipse.swt.graphics.RGBorg.eclipse.swt.graphics.FontDataAll methods declared on this class are static. This class cannot be instantiated.
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String[] |
asArray(java.lang.String value)
Breaks out space-separated words into an array of words.
|
static java.lang.String[] |
asArray(java.lang.String value,
java.lang.String[] dflt)
/**
Breaks out space-separated words into an array of words.
|
static boolean |
asBoolean(java.lang.String value)
Converts the given value into a boolean.
|
static boolean |
asBoolean(java.lang.String value,
boolean dflt)
Converts the given value into a boolean.
|
static java.lang.String |
asDisplayableString(FontData value)
Deprecated.
use asString(FontData)
|
static double |
asDouble(java.lang.String value)
Converts the given value into a double.
|
static double |
asDouble(java.lang.String value,
double dflt)
Converts the given value into a double.
|
static float |
asFloat(java.lang.String value)
Converts the given value into a float.
|
static float |
asFloat(java.lang.String value,
float dflt)
Converts the given value into a float.
|
static FontData |
asFontData(java.lang.String value)
Converts the given value into an SWT font data object.
|
static FontData |
asFontData(java.lang.String value,
FontData dflt)
Converts the given value into an SWT font data object.
|
static FontData[] |
asFontDataArray(java.lang.String value)
Convert the given value into an array of SWT font data objects.
|
static int |
asInt(java.lang.String value)
Converts the given value into an int.
|
static int |
asInt(java.lang.String value,
int dflt)
Converts the given value into an int.
|
static long |
asLong(java.lang.String value)
Converts the given value into a long.
|
static long |
asLong(java.lang.String value,
long dflt)
Converts the given value into a long.
|
static Point |
asPoint(java.lang.String value)
Converts the given value into an SWT point.
|
static Point |
asPoint(java.lang.String value,
Point dflt)
Converts the given value into an SWT point.
|
static Rectangle |
asRectangle(java.lang.String value)
Converts the given value into an SWT rectangle.
|
static Rectangle |
asRectangle(java.lang.String value,
Rectangle dflt)
Converts the given value into an SWT rectangle.
|
static RGB |
asRGB(java.lang.String value)
Converts the given value into an SWT RGB color value.
|
static RGB |
asRGB(java.lang.String value,
RGB dflt)
Converts the given value into an SWT RGB color value.
|
static java.lang.String |
asString(boolean value)
Converts the given boolean value to a string.
|
static java.lang.String |
asString(java.lang.Boolean value)
Converts the given boolean object to a string.
|
static java.lang.String |
asString(double value)
Converts the given double value to a string.
|
static java.lang.String |
asString(java.lang.Double value)
Converts the given double object to a string.
|
static java.lang.String |
asString(float value)
Converts the given float value to a string.
|
static java.lang.String |
asString(java.lang.Float value)
Converts the given float object to a string.
|
static java.lang.String |
asString(FontData value)
Converts a font data object to a string.
|
static java.lang.String |
asString(FontData[] value)
Converts a font data array to a string.
|
static java.lang.String |
asString(int value)
Converts the given int value to a string.
|
static java.lang.String |
asString(java.lang.Integer value)
Converts the given integer object to a string.
|
static java.lang.String |
asString(long value)
Converts the given long value to a string.
|
static java.lang.String |
asString(java.lang.Long value)
Converts the given long object to a string.
|
static java.lang.String |
asString(Point value)
Converts the given SWT point object to a string.
|
static java.lang.String |
asString(Rectangle value)
Converts the given SWT rectangle object to a string.
|
static java.lang.String |
asString(RGB value)
Converts the given SWT RGB color value object to a string.
|
static java.lang.String |
removeWhiteSpaces(java.lang.String s)
Returns the given string with all whitespace characters removed.
|
public static java.lang.String[] asArray(java.lang.String value)
throws DataFormatException
"no comment" into an array
a[0]="no" and a[1]= "comment".value - the string to be convertedDataFormatException - thrown if request string could not seperatedpublic static java.lang.String[] asArray(java.lang.String value,
java.lang.String[] dflt)
"no comment" into an array
a[0]="no" and a[1]= "comment".
Returns the given default value if the value cannot be parsed.value - the string to be converteddflt - the default valuepublic static boolean asBoolean(java.lang.String value)
throws DataFormatException
Valid representations of true include the strings
"t", "true", or equivalent in mixed
or upper case.
Similarly, valid representations of false include the strings
"f", "false", or equivalent in mixed
or upper case.
value - the value to be convertedDataFormatException - if the given value does not represent
a booleanpublic static boolean asBoolean(java.lang.String value,
boolean dflt)
value - the value to be converteddflt - the default valuepublic static double asDouble(java.lang.String value)
throws DataFormatException
value - the value to be convertedDataFormatException - if the given value does not represent
a doublepublic static double asDouble(java.lang.String value,
double dflt)
value - the value to be converteddflt - the default valuepublic static float asFloat(java.lang.String value)
throws DataFormatException
value - the value to be convertedDataFormatException - if the given value does not represent
a floatpublic static float asFloat(java.lang.String value,
float dflt)
value - the value to be converteddflt - the default valuepublic static FontData asFontData(java.lang.String value) throws DataFormatException
A valid font data representation is a string of the form
where
is the name of a font,
is a font style (one of
"regular", "bold",
"italic", or "bold italic")
and is an integer representing the
font height. Example: Times New Roman-bold-36.
value - the value to be convertedDataFormatException - if the given value does not represent
font datapublic static FontData[] asFontDataArray(java.lang.String value)
value - the font list stringpublic static FontData asFontData(java.lang.String value, FontData dflt)
value - the value to be converteddflt - the default valuepublic static int asInt(java.lang.String value)
throws DataFormatException
value - the value to be convertedDataFormatException - if the given value does not represent
an intpublic static int asInt(java.lang.String value,
int dflt)
value - the value to be converteddflt - the default valuepublic static long asLong(java.lang.String value)
throws DataFormatException
value - the value to be convertedDataFormatException - if the given value does not represent
a longpublic static long asLong(java.lang.String value,
long dflt)
value - the value to be converteddflt - the default valuepublic static Point asPoint(java.lang.String value) throws DataFormatException
A valid point representation is a string of the form
where
and
are valid ints.
value - the value to be convertedDataFormatException - if the given value does not represent
a pointpublic static Point asPoint(java.lang.String value, Point dflt)
value - the value to be converteddflt - the default valuepublic static Rectangle asRectangle(java.lang.String value) throws DataFormatException
A valid rectangle representation is a string of the form
where , ,
, and
are valid ints.
value - the value to be convertedDataFormatException - if the given value does not represent
a rectanglepublic static Rectangle asRectangle(java.lang.String value, Rectangle dflt)
value - the value to be converteddflt - the default valuepublic static RGB asRGB(java.lang.String value) throws DataFormatException
A valid RGB color value representation is a string of the form
,, are valid ints.
value - the value to be convertedDataFormatException - if the given value does not represent
an RGB color valuepublic static RGB asRGB(java.lang.String value, RGB dflt)
value - the value to be converteddflt - the default valuepublic static java.lang.String asString(double value)
String.valueOf(value).value - the double valuepublic static java.lang.String asString(float value)
String.valueOf(value).value - the float valuepublic static java.lang.String asString(int value)
String.valueOf(value).value - the int valuepublic static java.lang.String asString(long value)
String.valueOf(value).value - the long valuepublic static java.lang.String asString(java.lang.Boolean value)
String.valueOf(value.booleanValue()).value - the boolean objectpublic static java.lang.String asString(java.lang.Double value)
String.valueOf(value.doubleValue()).value - the double objectpublic static java.lang.String asString(java.lang.Float value)
String.valueOf(value.floatValue()).value - the float objectpublic static java.lang.String asString(java.lang.Integer value)
String.valueOf(value.intValue()).value - the integer objectpublic static java.lang.String asString(java.lang.Long value)
String.valueOf(value.longValue()).value - the long objectpublic static java.lang.String asString(FontData[] value)
value - The font data.public static java.lang.String asString(FontData value)
value - The font data.public static java.lang.String asString(Point value)
The string representation of a point has the form
where
and
are string representations of integers.
value - the point objectpublic static java.lang.String asString(Rectangle value)
The string representation of a rectangle has the form
where , ,
, and
are string representations of integers.
value - the rectangle objectpublic static java.lang.String asString(RGB value)
The string representation of an RGB color value has the form
,, are string representations of integers.
value - the RGB color value objectpublic static java.lang.String asString(boolean value)
String.valueOf(value).value - the boolean valuepublic static java.lang.String removeWhiteSpaces(java.lang.String s)
All characters that have codes less than or equal to '\u0020'
(the space character) are considered to be a white space.
s - the source string@Deprecated public static java.lang.String asDisplayableString(FontData value)
value - The font data.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.