|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.epseelon.mobimap.util.TextUtil
public final class TextUtil
Provides some usefull String methods.
Copyright Enough Software 2004 - 2008
history
20-Apr-2004 - rob creation
| Constructor Summary | |
|---|---|
TextUtil()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
encodeUrl(java.lang.String url)
Encodes a URL string. |
static boolean |
equalsIgnoreCase(java.lang.String str1,
java.lang.String str2)
Compares two strings in a case-insensitive way. |
static int |
lastIndexOf(java.lang.String text,
java.lang.String match)
Retrieves the last index of the given match in the specified text. |
static java.lang.String |
replace(java.lang.String input,
java.lang.String search,
java.lang.String replacement)
Replaces the all matches within a String. |
static java.lang.String |
replaceFirst(java.lang.String input,
java.lang.String search,
java.lang.String replacement)
Replaces the first match in a String. |
static java.lang.String |
replaceLast(java.lang.String input,
java.lang.String search,
java.lang.String replacement)
Replaces the last match in a String. |
static java.lang.String |
reverseForRtlLanguage(java.lang.String input)
Reverses the given text while keeping English texts and numbers in the normal position. |
static java.lang.String[] |
split(java.lang.String value,
char delimiter)
Splits the given String around the matches defined by the given delimiter into an array. |
static java.lang.String[] |
split(java.lang.String value,
char delimiter,
int numberOfChunks)
Splits the given String around the matches defined by the given delimiter into an array. |
static java.lang.String[] |
splitAndTrim(java.lang.String value,
char delimiter)
Splits the given String around the matches defined by the given delimiter into an array. |
static java.lang.String[] |
wrap(java.lang.String value,
javax.microedition.lcdui.Font font,
int firstLineWidth,
int lineWidth)
Wraps the given string so it fits on the specified lines. |
static void |
wrap(java.lang.String value,
javax.microedition.lcdui.Font font,
int completeWidth,
int firstLineWidth,
int lineWidth,
java.util.Vector list)
Wraps the given string so that the substrings fit into the the given line-widths. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextUtil()
| Method Detail |
|---|
public static java.lang.String[] split(java.lang.String value,
char delimiter)
TextUtil.split("one;two;three", ';') results into the array
{"one", "two", "three"}.
value - the String which should be split into an arraydelimiter - the delimiter which marks the boundaries of the array
public static java.lang.String[] splitAndTrim(java.lang.String value,
char delimiter)
TextUtil.splitAndTrim(" one; two; three", ';') results into the array
{"one", "two", "three"}.
value - the String which should be split into an arraydelimiter - the delimiter which marks the boundaries of the array
public static java.lang.String[] split(java.lang.String value,
char delimiter,
int numberOfChunks)
TextUtil.split("one;two;three", ';', 3) results into the array
{"one", "two", "three"}.TextUtil.split("one;two;three", ';', 4) results into the array
{"one", "two", "three", null}.TextUtil.split("one;two;three", ';', 2) results into the array
{"one", "two"}.
value - the String which should be split into an arraydelimiter - the delimiter which marks the boundaries of the arraynumberOfChunks - the number of expected matches
public static java.lang.String[] wrap(java.lang.String value,
javax.microedition.lcdui.Font font,
int firstLineWidth,
int lineWidth)
value - the string which should be splittedfont - the font which is used to display the fontfirstLineWidth - the allowed width for the first linelineWidth - the allowed width for all other lines, lineWidth >= firstLineWidth
public static void wrap(java.lang.String value,
javax.microedition.lcdui.Font font,
int completeWidth,
int firstLineWidth,
int lineWidth,
java.util.Vector list)
value - the string which should be splittedfont - the font which is used to display the fontcompleteWidth - the complete width of the given string for the specified font.firstLineWidth - the allowed width for the first linelineWidth - the allowed width for all other lines, lineWidth >= firstLineWidthlist - the list to which the substrings will be added.public static java.lang.String encodeUrl(java.lang.String url)
url - URL to encode
public static java.lang.String replace(java.lang.String input,
java.lang.String search,
java.lang.String replacement)
input - the input stringsearch - the string that should be replacedreplacement - the replacement
java.lang.NullPointerException - when one of the specified strings is null
public static java.lang.String replaceFirst(java.lang.String input,
java.lang.String search,
java.lang.String replacement)
input - the input stringsearch - the string that should be replacedreplacement - the replacement
java.lang.NullPointerException - when one of the specified strings is null
public static java.lang.String replaceLast(java.lang.String input,
java.lang.String search,
java.lang.String replacement)
input - the input stringsearch - the string that should be replacedreplacement - the replacement
java.lang.NullPointerException - when one of the specified strings is null
public static int lastIndexOf(java.lang.String text,
java.lang.String match)
text - the text in which the match is givenmatch - the match within the text
java.lang.NullPointerException - when text or match is null
public static boolean equalsIgnoreCase(java.lang.String str1,
java.lang.String str2)
true,
false otherwise.
str1 - the string to comparestr2 - the string to compare to
true if both strings are equals except case,
false
java.lang.NullPointerException - if str1 is nullString.equals(Object),
String.equalsIgnoreCase(String)public static java.lang.String reverseForRtlLanguage(java.lang.String input)
input - the text
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||