|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.alee.utils.TextUtils
public final class TextUtils
This class provides a set of utilities to work with various text usage cases.
Constructor Summary | |
---|---|
TextUtils()
|
Method Summary | ||
---|---|---|
static java.lang.String |
createString(java.lang.String character,
int length)
Creates new string filled with specified amount of same characters. |
|
static
|
enumListToString(java.util.List<E> enumList)
Converts list of enumeration constants into string with list of enumeration constants and returns it. |
|
static
|
enumStringToList(java.lang.String enumString,
java.lang.Class<E> enumClass)
Converts string with list of enumeration constants into real list of enumeration constants and returns it. |
|
static java.lang.Integer |
findFirstNumber(java.lang.String text)
Returns first number found in text. |
|
static java.lang.String |
generateId()
Returns random ID with default prefix and suffix. |
|
static java.lang.String |
generateId(java.lang.String prefix)
Returns random ID with specified prefix and default suffix. |
|
static java.lang.String |
generateId(java.lang.String prefix,
java.lang.String suffix)
Returns random ID with specified prefix and suffix. |
|
static java.lang.String |
getWord(java.lang.String text,
int location)
Returns a word from text at the specified location. |
|
static int |
getWordEnd(java.lang.String text,
int location)
Returns a word end index at the specified location. |
|
static int |
getWordStart(java.lang.String text,
int location)
Returns a word start index at the specified location. |
|
static
|
listToString(java.util.List<T> list,
java.lang.String separator,
TextProvider<T> textProvider)
Returns single text combined using list of strings and specified separator. |
|
static java.lang.String |
listToString(java.util.List list,
java.lang.String separator)
Returns single text combined using list of strings and specified separator. |
|
static java.awt.Point |
parsePoint(java.lang.String text)
Returns point extracted from text. |
|
static java.awt.Point |
parsePoint(java.lang.String text,
java.lang.String separator)
Returns point extracted from text. |
|
static java.lang.String |
removeControlSymbols(java.lang.String text)
Returns text with all control symbols removed. |
|
static java.lang.String |
removeFirstLines(java.lang.String text,
int count)
Returns text with first lines removed. |
|
static java.lang.String |
shortenText(java.lang.String text,
int maxLength,
boolean addDots)
Returns shortened text. |
|
static java.lang.String |
shortenTextEnd(java.lang.String text,
int maxLength,
boolean addDots)
Returns shortened text. |
|
static java.util.List<java.lang.String> |
split(java.lang.String text,
java.lang.String separator)
Returns a list of text parts splitted using specified separator. |
|
static java.util.List<java.lang.Integer> |
stringToIntList(java.lang.String string,
java.lang.String separator)
Returns a list of integer parts splitted using specified separator. |
|
static java.util.List<java.lang.String> |
stringToList(java.lang.String string,
java.lang.String separator)
Returns a list of text parts splitted using specified separator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextUtils()
Method Detail |
---|
public static java.lang.Integer findFirstNumber(java.lang.String text)
text
- text to search through
public static java.lang.String getWord(java.lang.String text, int location)
text
- text to retrieve the word fromlocation
- word location
public static int getWordStart(java.lang.String text, int location)
text
- text to retrieve the word start index fromlocation
- word location
public static int getWordEnd(java.lang.String text, int location)
text
- text to retrieve the word end index fromlocation
- word location
public static java.lang.String removeFirstLines(java.lang.String text, int count)
text
- text to cropcount
- lines count to crop
public static java.util.List<java.lang.String> split(java.lang.String text, java.lang.String separator)
text
- text to splitseparator
- text parts separator
public static java.awt.Point parsePoint(java.lang.String text)
text
- text to extract point from
public static java.awt.Point parsePoint(java.lang.String text, java.lang.String separator)
text
- text to extract point fromseparator
- point values separator
public static java.lang.String removeControlSymbols(java.lang.String text)
text
- text to modify
public static java.lang.String shortenText(java.lang.String text, int maxLength, boolean addDots)
text
- text to shortenmaxLength
- maximum shortened text lenghtaddDots
- add dots at the end of the text when shortened
public static java.lang.String shortenTextEnd(java.lang.String text, int maxLength, boolean addDots)
text
- text to shortenmaxLength
- maximum shortened text lenghtaddDots
- add dots at the end of the text when shortened
public static java.util.List<java.lang.String> stringToList(java.lang.String string, java.lang.String separator)
string
- text to splitseparator
- text parts separator
public static java.util.List<java.lang.Integer> stringToIntList(java.lang.String string, java.lang.String separator)
string
- text to splitseparator
- text parts separator
public static java.lang.String listToString(java.util.List list, java.lang.String separator)
list
- list to combine into single textseparator
- text parts separator
public static <T> java.lang.String listToString(java.util.List<T> list, java.lang.String separator, TextProvider<T> textProvider)
list
- list to combine into single textseparator
- text parts separatortextProvider
- text provider
public static <E extends java.lang.Enum<E>> java.lang.String enumListToString(java.util.List<E> enumList)
E
- enumeration typeenumList
- enumeration constants list
public static <E extends java.lang.Enum<E>> java.util.List<E> enumStringToList(java.lang.String enumString, java.lang.Class<E> enumClass)
E
- enumeration typeenumString
- enumeration constants string listenumClass
- enumeration class
public static java.lang.String createString(java.lang.String character, int length)
character
- character to fill string withlength
- string length
public static java.lang.String generateId()
public static java.lang.String generateId(java.lang.String prefix)
prefix
- id prefix
public static java.lang.String generateId(java.lang.String prefix, java.lang.String suffix)
prefix
- id prefixsuffix
- id suffix
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |