|
intarsys runtime library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.intarsys.tools.string.StringTools
public class StringTools
A tool class for the handling of strings.
Field Summary | |
---|---|
static String |
CR
|
static String |
CRLF
|
static String |
DATEFORMAT_SIMPLE
|
static String |
EMPTY
An empty string constant |
static String |
FORMAT_D
|
static String |
FORMAT_F
|
static String |
FORMAT_I
|
static String |
FORMAT_P
|
static String |
FORMAT_S
|
static String |
LF
|
static String |
SPACE
An single space constant |
Constructor Summary | |
---|---|
StringTools()
|
Method Summary | |
---|---|
static String |
capitalize(String text)
Capitalizes the first letter of the text. |
static void |
clear(char[] value)
clear character array content. |
static String |
format(Object value,
String format)
Create a string representation and format value according
to the instructions in format . |
static String |
getCommonPrefix(String a,
String b,
boolean ignoreCase)
|
static String |
getFirstLine(String text)
The first line of text (all characters up to the first occurence of either "\n" or "\r". |
static String |
getLeading(String value,
int count)
|
static int |
getLineCount(String text)
The number of lines in text . |
static String |
getTrailing(String value,
int count)
|
static boolean |
isEmpty(char[] value)
true if value is "empty" in any respect. |
static boolean |
isEmpty(String value)
true if value is "empty" in any respect. |
static boolean |
isNumeric(String value)
true if value seems to be a numeric value. |
static String[] |
parseCommandline(String line)
Parse a commandline string with the default escape character. |
static String[] |
parseCommandline(String line,
char escape)
Parse a commandline string. |
static String |
safeString(Object object)
Create a string representation of object that is guaranteed
not to fail in any case. |
static byte[] |
toByteArray(String value)
Create a byte array from the string. |
static String |
toString(byte[] value)
Create a string from the byte array. |
static String |
trimAlphaNumeric(String value)
Create a string containing only the alphanumeric content of value . |
static String |
trimLeft(String value)
Create a new string from value without leading whitespace. |
static String |
trimRight(String value)
Create a new string from value without trailing whitespace. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String LF
public static final String CRLF
public static final String CR
public static final String DATEFORMAT_SIMPLE
public static final String FORMAT_P
public static final String FORMAT_D
public static final String FORMAT_I
public static final String FORMAT_F
public static final String FORMAT_S
public static final String EMPTY
public static final String SPACE
Constructor Detail |
---|
public StringTools()
Method Detail |
---|
public static String capitalize(String text)
text
-
public static void clear(char[] value)
value
- The value to be clearedpublic static String format(Object value, String format)
value
according
to the instructions in format
.
If value
is null, the empty string is returned.
public static String getCommonPrefix(String a, String b, boolean ignoreCase)
public static String getFirstLine(String text)
text
- The text where the first line is looked up.
public static String getLeading(String value, int count)
public static int getLineCount(String text)
text
. This is 1 + the number of "\n"
in text
.
text
- The text where the lines are counted.
text
. This is 1 + the number
of "\n" in text
.public static String getTrailing(String value, int count)
public static boolean isEmpty(char[] value)
true
if value
is "empty" in any respect.
This is the case when value == null, value has no characters or only whitespace.
value
- The value to be inspected for emptyness.
true
if value
is "empty" in any
respect.public static boolean isEmpty(String value)
true
if value
is "empty" in any respect.
This is the case when value == null, value has no characters or only whitespace.
value
- The value to be inspected for emptyness.
true
if value
is "empty" in any
respect.public static boolean isNumeric(String value)
true
if value
seems to be a numeric value. To
qualify only the first character is examined. value
qualifies as numeric if the first character is a digit, a "+", a "-" or a
".".
pageSizeString
-
true
if value
seems to be numeric.public static String[] parseCommandline(String line)
line
- The commandline string.
public static String[] parseCommandline(String line, char escape)
line
- The commandline string.
public static String safeString(Object object)
object
that is guaranteed
not to fail in any case.
object
- The object to be printed.
object
that is
guaranteed not to fail in any case.public static byte[] toByteArray(String value)
If you use this, you should be sure you will encounter valid ascii characters only!
value
-
public static String toString(byte[] value)
If you use this, you should be sure you will encounter valid ascii characters only!
value
-
public static String trimAlphaNumeric(String value)
value
.
value
- The string to be trimmed.
value
.public static String trimLeft(String value)
value
without leading whitespace.
value
- The string to be stripped.
value
with leading whitespace stripped.public static String trimRight(String value)
value
without trailing whitespace.
value
- The string to be stripped.
value
with trailing whitespace stripped.
|
intarsys runtime library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |