public class TextUtils
extends java.lang.Object
Constructor and Description |
---|
TextUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
atoi(java.lang.String s)
Method to parse the number in a string.
|
static int |
atoi(java.lang.String s,
int pos)
Method to parse the number in a string.
|
static int |
atoi(java.lang.String s,
int pos,
int base)
Method to parse the number in a string.
|
static java.lang.String |
formatDouble(double v)
Method to convert a double to a string.
|
static java.lang.String |
formatDouble(double v,
int numFractions)
Method to convert a double to a string.
|
static boolean |
isDigit(char ch)
Determines if the specified character is a ISO-LATIN-1 digit
(
'0' through '9' ). |
static boolean |
isLetterOrDigit(char ch)
Determines if the specified character is a letter or digit.
|
static boolean |
startsWithIgnoreCase(java.lang.String main,
java.lang.String with)
Method to determine if one string is a subset of another, but case-insensitive.
|
public static boolean isDigit(char ch)
'0'
through '9'
).
This can be method instead of Character, if we are not ready to handle Arabi-Indic, Devanagaru and other digits.
ch
- the character to be tested.true
if the character is a ISO-LATIN-1 digit;
false
otherwise.Character.isDigit(char)
public static boolean isLetterOrDigit(char ch)
A character is considered to be a letter or digit if either
Character.isLetter(char ch)
or
TextUtils.isDigit(char ch)
returns
true
for the character.
ch
- the character to be tested.true
if the character is a letter or digit;
false
otherwise.isDigit(char)
,
Character.isJavaLetterOrDigit(char)
,
Character.isLetter(char)
public static boolean startsWithIgnoreCase(java.lang.String main, java.lang.String with)
main
- the main string.with
- the substring.public static int atoi(java.lang.String s)
There are many reasons to use this method instead of Integer.parseInt...
s
- the string with a number in it.public static int atoi(java.lang.String s, int pos)
s
- the string with a number in it.pos
- the starting position in the string to find the number.public static int atoi(java.lang.String s, int pos, int base)
s
- the string with a number in it.pos
- the starting position in the string to find the number.base
- the forced base of the number (0 to determine it automatically).public static java.lang.String formatDouble(double v)
v
- the double value to format.public static java.lang.String formatDouble(double v, int numFractions)
v
- the double value to format.numFractions
- the number of digits to the right of the decimal point.