|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jaxfront.core.util.TextTools
public class TextTools
This class includes some nice features to convert and edit text. For example: the method colorToHex(Color) converts a Color Object into its Hex values.
Field Summary | |
---|---|
static char |
CHAR_EMPTY
|
static char |
CHAR_NEWLINE
|
static char |
CHAR_SPACE
|
static int |
DIFFERENCE_IN_DAYS
|
static int |
DIFFERENCE_IN_MS
|
static java.lang.String |
ISO_DATE_PATTERN
|
static java.lang.String |
ISO_DATE_TIME_PATTERN
|
static java.lang.String |
ISO_TIME_PATTERN
|
static java.text.SimpleDateFormat |
isoDateFormat
|
static int |
iSODateFormat
|
static XSDDateFormat |
isoDateTimeFormat
|
static int |
iSODateTimeFormat
|
static int |
iSONoFormat
|
static java.text.SimpleDateFormat |
isoTimeFormat
|
static int |
iSOTimeFormat
|
static char |
NATIVE_DECIMAL_SEP
|
static java.lang.String |
PI_END_TAG
|
static java.lang.String |
PI_START_TAG
|
static java.lang.String |
SQL_DATE_TIME_PATTERN
|
static java.text.SimpleDateFormat |
sqlDateTIMEFormat
|
static java.awt.Graphics |
STRING_LENGTH_GRAPHICS
|
Method Summary | |
---|---|
static int |
calculateTextLength(java.awt.Font aFont,
java.lang.String text)
|
static java.lang.String |
colorToHex(java.awt.Color color)
Converts a Color into its Hex values. |
static java.lang.String[] |
compactStrings(java.lang.String[] strings)
|
static int |
compareTo(char[] string1,
char[] string2)
|
static int |
compareTo(char[] string1,
int offsetC1,
char[] string2,
int offsetC2)
Compares two strings lexicographically. |
static java.lang.String |
convertExponentialValue(java.lang.String number)
|
static java.lang.String |
convertNumbersToNative(java.lang.String number,
java.text.DecimalFormatSymbols symbols)
|
static java.lang.String |
convertNumbersToView(java.lang.String number,
java.text.DecimalFormat format,
boolean useGrouping)
|
static java.lang.String |
convertSQLDateToIsoDate(java.lang.String dateStr)
|
static int |
countCharBetween(java.lang.String source,
int start,
int end,
char charakter,
char direction)
Counts the occured named characters between a start and end index of a string. |
static java.awt.Color |
createColor(java.lang.String colorAsString)
|
static java.lang.String |
createDelimited(java.util.List s,
java.lang.String delimiter,
java.lang.String fieldSeparator)
|
static java.lang.String |
createDelimited(java.lang.String[] s,
char delimiter,
char fieldSeparator)
|
static java.lang.String |
createDelimited(java.lang.String[] s,
java.lang.String delimiter)
|
static java.lang.String |
createHTMLString(java.lang.String content)
|
static long |
difference(java.util.Date from,
java.util.Date to,
int mode)
|
static java.lang.String |
escapeNLSEntities(java.lang.String value)
Replaces the global entities of a String. |
static java.lang.StringBuffer |
exportToCSV(int startCol,
java.lang.String[] columnNames,
java.lang.String[][] array)
|
static int |
extractDateDelimiter(java.lang.String pattern,
char dateSymbol)
Extract a possible separator for the given date symbol to it's antecessor returns -1 if not found, otherwise the char int |
static java.lang.String |
formatDate(long number,
java.lang.String pattern)
Method format calls the java.text.DecimalFormat class with the given parameters. |
static java.lang.String |
formatToISODate(java.text.DateFormat currentFormat,
java.lang.String currentFormatedDate)
|
static java.lang.String |
formatToISODate(java.lang.String pattern,
java.lang.String currentFormatedDate)
|
static java.lang.String |
formatToISODateTime(java.text.DateFormat currentFormat,
java.lang.String currentFormatedDateTime)
|
static java.lang.String |
formatToISODateTime(java.text.DateFormat currentFormat,
java.lang.String currentFormatedDateTime,
boolean hasReqEx)
|
static java.lang.String |
formatToISOTime(java.text.DateFormat currentFormat,
java.lang.String currentFormatedTime)
|
static byte[] |
fromHexStringToByte(java.lang.String hex)
|
static java.lang.String[] |
getChoicesWithNoneEntry(java.lang.String[] choices)
|
static java.lang.String |
getClassName(java.lang.Class aClass)
|
static java.lang.String |
getContentFromURL(java.net.URL url)
|
static java.lang.String |
getCurrentISODate()
|
static java.lang.String |
getCurrentISODateTime()
|
static java.lang.String |
getCurrentISODateTime(long time)
|
static java.lang.String |
getCurrentISOTime(long time)
|
static int |
getDateDelimiterFor(java.lang.String pattern,
char dateSymbol)
Extract a possible separator for the given date symbol to it's antecessor returns -1 if not found, 0 if found at index 0, otherwise the char int value of the separator |
static int |
getNodeEndPos(java.lang.String content,
java.lang.String nodeName,
int start,
char nodeStartQualifier,
char nodeEndQualifier)
|
static java.util.HashMap |
getProcessingInstruction(java.lang.String xml)
|
static java.lang.String |
getSeasonSplashName()
|
static int |
getUsedISODateFormat(java.lang.String value)
|
static java.lang.String |
hardCoreIsoConverter(java.lang.String pattern,
java.lang.String value)
Extract a possible separator for the given date symbol to it's antecessor returns -1 if not found, otherwise the char int |
static int |
hasChar(java.lang.String source,
int pos,
char charakter,
char direction)
|
static boolean |
isISODate(java.lang.String currentFormatedDate)
|
static boolean |
isISODateTime(java.lang.String currentFormatedDate)
|
static boolean |
isISOTime(java.lang.String currentFormatedTime)
|
static void |
main(java.lang.String[] args)
|
static java.lang.StringBuffer |
out(java.lang.String s,
java.text.BreakIterator iter)
|
static boolean |
parseBoolean(java.lang.String value,
boolean defaultValue)
|
static byte |
parseByte(java.lang.String value,
byte defaultValue)
|
static int |
parseInt(java.lang.String value,
int defaultValue)
|
static java.util.Date |
parseISODate(java.lang.String dateStr)
|
static long |
parseLong(java.lang.String value,
long defaultValue)
|
static java.util.Date |
parseSQLDate(java.lang.String dateStr)
|
static java.lang.String |
quote(java.lang.String text)
Quotes any passing text. |
static java.lang.String |
removeChar(java.lang.String source,
char aChar)
|
static java.lang.String |
removeInvalidUnicodeChars(java.lang.String toClean)
|
static java.lang.String |
removeSingleOccureChar(java.lang.String source,
char aChar)
|
static java.lang.String |
removeSpaceChars(java.lang.String result)
|
static java.lang.String |
removeSpecialChars(java.lang.String toClean)
|
static char[] |
removeTrailingChar(char[] source,
char aChar,
int offset,
char stopChar)
|
static char[] |
replace(char[] source,
char from,
char to)
|
static java.lang.String |
replace(java.lang.String source,
char from,
char to)
|
static java.lang.String |
replace(java.lang.String source,
java.lang.String oldString,
java.lang.String newString)
Replaces a text of a String by a new one. |
static java.lang.String |
replace(java.lang.String source,
java.lang.String oldString,
java.lang.String newString,
java.lang.String splitCharacter)
Replaces a text of a String by a new one. |
static java.lang.String |
replaceGlobalEntities(java.lang.String value)
Replaces the global entities of a String. |
static java.lang.String |
replaceGlobalHTMLEntities(java.lang.String value)
Replaces the global entities of a String. |
static java.lang.String |
replaceGlobalUserProperties(java.lang.String value,
Document dom)
Replaces the global user properties for a String. |
static java.lang.String |
reverseText(java.lang.String text)
Reverses the given text. |
static java.lang.String |
splitText(java.lang.String text)
|
static java.lang.String |
splitTextMaxLength(java.lang.String text,
int maxLength)
|
static java.lang.String |
substringAfter(java.lang.String source,
java.lang.String from)
|
static java.lang.String |
toHexString(byte b)
|
static java.lang.String |
toHexString(byte[] bytes)
|
static java.lang.String[] |
tokenize(java.lang.String s,
java.lang.String delimiter)
Tokenizes a String and returns its token in a String array. |
static java.lang.Integer[] |
tokenizeToInteger(java.lang.String s,
java.lang.String delimiter)
Tokenizes a String and returns its token in a String array. |
static java.lang.String |
toString(java.lang.Object[] objects)
Creates a comma separated string representation of an object array. |
static java.lang.String |
translateVar(java.lang.String aValue,
Document dom)
|
static java.lang.String |
unEscapeNLSEntities(java.lang.String value)
Replaces the global entities of a String. |
static java.lang.String |
unquote(java.lang.String text)
Removes the start and end quotes from any passing text. |
static java.lang.StringBuffer |
wordOut(java.lang.String s,
java.text.BreakIterator iter,
int maxLength)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char CHAR_SPACE
public static final char CHAR_EMPTY
public static final char CHAR_NEWLINE
public static final char NATIVE_DECIMAL_SEP
public static final java.lang.String PI_START_TAG
public static final java.lang.String PI_END_TAG
public static final java.lang.String ISO_DATE_PATTERN
public static final java.lang.String ISO_DATE_TIME_PATTERN
public static final java.lang.String SQL_DATE_TIME_PATTERN
public static final java.lang.String ISO_TIME_PATTERN
public static java.text.SimpleDateFormat isoDateFormat
public static java.text.SimpleDateFormat sqlDateTIMEFormat
public static XSDDateFormat isoDateTimeFormat
public static java.text.SimpleDateFormat isoTimeFormat
public static final java.awt.Graphics STRING_LENGTH_GRAPHICS
public static final int iSONoFormat
public static final int iSODateFormat
public static final int iSODateTimeFormat
public static final int iSOTimeFormat
public static final int DIFFERENCE_IN_DAYS
public static final int DIFFERENCE_IN_MS
Method Detail |
---|
public static java.lang.String getClassName(java.lang.Class aClass)
public static void main(java.lang.String[] args)
public static java.lang.String convertNumbersToNative(java.lang.String number, java.text.DecimalFormatSymbols symbols)
public static java.lang.String convertNumbersToView(java.lang.String number, java.text.DecimalFormat format, boolean useGrouping)
public static java.lang.String colorToHex(java.awt.Color color)
Color
- a Color to convert
public static java.lang.String replace(java.lang.String source, java.lang.String oldString, java.lang.String newString)
source
- the original String that contains the old textoldString
- the text that should be replaced by the new onenewString
- the new text that replaces the old one
public static java.lang.String removeChar(java.lang.String source, char aChar)
public static java.lang.String removeSingleOccureChar(java.lang.String source, char aChar)
public static char[] removeTrailingChar(char[] source, char aChar, int offset, char stopChar)
public static java.lang.String substringAfter(java.lang.String source, java.lang.String from)
public static java.lang.String replace(java.lang.String source, java.lang.String oldString, java.lang.String newString, java.lang.String splitCharacter)
source
- the original String that contains the old textoldString
- the text that should be replaced by the new onenewString
- the new text that replaces the old onesplitCharacter
- a character that is added at the end of both the oldString and
newString
public static java.lang.String replaceGlobalEntities(java.lang.String value)
value
- a String that contains global entities
public static java.lang.String replaceGlobalHTMLEntities(java.lang.String value)
value
- a String that contains global entities
public static java.lang.String escapeNLSEntities(java.lang.String value)
value
- a String that contains global entities
public static java.lang.String unEscapeNLSEntities(java.lang.String value)
value
- a String that contains global entities
public static java.lang.String replaceGlobalUserProperties(java.lang.String value, Document dom)
value
- a String that contains global user propertiesdom
- a JAXFront Document (DOM)
public static java.lang.String[] tokenize(java.lang.String s, java.lang.String delimiter)
s
- a String that needs to be tokenizeddelimiter
- delimiter parameters for the tokenizer
public static java.lang.Integer[] tokenizeToInteger(java.lang.String s, java.lang.String delimiter)
s
- a String that needs to be tokenizeddelimiter
- delimiter parameters for the tokenizer
public static java.lang.String createDelimited(java.lang.String[] s, java.lang.String delimiter)
public static java.lang.String createDelimited(java.util.List s, java.lang.String delimiter, java.lang.String fieldSeparator)
public static java.lang.String createDelimited(java.lang.String[] s, char delimiter, char fieldSeparator)
public static int hasChar(java.lang.String source, int pos, char charakter, char direction)
public static java.lang.String reverseText(java.lang.String text)
text
- java.lang.String a text
public static int countCharBetween(java.lang.String source, int start, int end, char charakter, char direction)
source
- string to processstart
- index to startend
- index to endcharakter
- to countdirection
- to processspublic static int compareTo(char[] string1, int offsetC1, char[] string2, int offsetC2)
String
object is compared
lexicographically to the character sequence represented by the argument
string. The result is a negative integer if this String
object lexicographically precedes the argument string. The result is a
positive integer if this String
object lexicographically
follows the argument string. The result is zero if the strings are equal;
compareTo
returns 0
exactly when the
Object.equals(Object)
method would return true
.
This is the definition of lexicographic ordering. If two strings are
different, then either they have different characters at some index that
is a valid index for both strings, or their lengths are different, or
both. If they have different characters at one or more index positions,
let k be the smallest such index; then the string whose character
at position k has the smaller value, as determined by using the
< operator, lexicographically precedes the other string. In this case,
compareTo
returns the difference of the two character
values at position k
in the two string -- that is, the
value:
If there is no index position at which they differ, then the shorter string lexicographically precedes the longer string. In this case,this.charAt(k) - anotherString.charAt(k)
compareTo
returns the difference of the lengths of
the strings -- that is, the value: this.length() - anotherString.length()
anotherString
- the String
to be compared.
0
if the argument string is equal to
this string; a value less than 0
if this string is
lexicographically less than the string argument; and a value
greater than 0
if this string is lexicographically
greater than the string argument.public static java.lang.String toHexString(byte b)
public static java.lang.String toHexString(byte[] bytes)
public static byte[] fromHexStringToByte(java.lang.String hex)
public static int compareTo(char[] string1, char[] string2)
public static java.lang.String toString(java.lang.Object[] objects)
objects
- to create string from
public static java.lang.String quote(java.lang.String text)
text
- to quotepublic static java.lang.String unquote(java.lang.String text)
text
- to unquotepublic static java.lang.String getSeasonSplashName()
public static java.awt.Color createColor(java.lang.String colorAsString)
public static java.lang.String getContentFromURL(java.net.URL url) throws java.io.IOException
java.io.IOException
public static java.lang.String[] compactStrings(java.lang.String[] strings)
public static java.lang.String convertExponentialValue(java.lang.String number) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public static java.util.HashMap getProcessingInstruction(java.lang.String xml)
public static java.lang.String getCurrentISODate()
public static java.lang.String getCurrentISODateTime()
public static java.lang.String getCurrentISODateTime(long time)
public static java.lang.String getCurrentISOTime(long time)
public static java.lang.String formatToISODate(java.text.DateFormat currentFormat, java.lang.String currentFormatedDate) throws java.text.ParseException
java.text.ParseException
public static java.lang.String formatToISODateTime(java.text.DateFormat currentFormat, java.lang.String currentFormatedDateTime) throws java.text.ParseException
java.text.ParseException
public static java.lang.String formatToISODateTime(java.text.DateFormat currentFormat, java.lang.String currentFormatedDateTime, boolean hasReqEx) throws java.text.ParseException
java.text.ParseException
public static java.lang.String formatToISOTime(java.text.DateFormat currentFormat, java.lang.String currentFormatedTime) throws java.text.ParseException
java.text.ParseException
public static java.lang.String formatToISODate(java.lang.String pattern, java.lang.String currentFormatedDate) throws java.text.ParseException
java.text.ParseException
public static int getUsedISODateFormat(java.lang.String value)
public static boolean isISODate(java.lang.String currentFormatedDate)
public static boolean isISODateTime(java.lang.String currentFormatedDate)
public static boolean isISOTime(java.lang.String currentFormatedTime)
public static java.lang.String formatDate(long number, java.lang.String pattern)
number
- pattern
-
public static int getNodeEndPos(java.lang.String content, java.lang.String nodeName, int start, char nodeStartQualifier, char nodeEndQualifier)
public static java.lang.StringBuffer wordOut(java.lang.String s, java.text.BreakIterator iter, int maxLength)
public static java.lang.String splitTextMaxLength(java.lang.String text, int maxLength)
public static java.lang.String splitText(java.lang.String text)
public static java.lang.StringBuffer out(java.lang.String s, java.text.BreakIterator iter)
public static long difference(java.util.Date from, java.util.Date to, int mode)
public static java.lang.String removeSpecialChars(java.lang.String toClean)
public static java.lang.String removeInvalidUnicodeChars(java.lang.String toClean)
public static java.lang.String removeSpaceChars(java.lang.String result)
public static java.lang.String createHTMLString(java.lang.String content)
public static java.lang.String[] getChoicesWithNoneEntry(java.lang.String[] choices)
public static int getDateDelimiterFor(java.lang.String pattern, char dateSymbol)
pattern
- dateSymbol
-
public static int extractDateDelimiter(java.lang.String pattern, char dateSymbol)
pattern
- dateSymbol
-
public static java.lang.String hardCoreIsoConverter(java.lang.String pattern, java.lang.String value)
pattern
- dateSymbol
-
public static java.lang.String replace(java.lang.String source, char from, char to)
public static char[] replace(char[] source, char from, char to)
public static java.lang.StringBuffer exportToCSV(int startCol, java.lang.String[] columnNames, java.lang.String[][] array)
public static int calculateTextLength(java.awt.Font aFont, java.lang.String text)
public static int parseInt(java.lang.String value, int defaultValue)
public static long parseLong(java.lang.String value, long defaultValue)
public static boolean parseBoolean(java.lang.String value, boolean defaultValue)
public static byte parseByte(java.lang.String value, byte defaultValue)
public static java.lang.String translateVar(java.lang.String aValue, Document dom)
public static java.lang.String convertSQLDateToIsoDate(java.lang.String dateStr)
public static java.util.Date parseISODate(java.lang.String dateStr)
public static java.util.Date parseSQLDate(java.lang.String dateStr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |