public class TextHandler
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INDENT |
static java.lang.String |
NODESCRIPTION
Text constants
|
| Constructor and Description |
|---|
TextHandler() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsLetters(java.lang.String theText)
Return true if the text contains letters.
|
static boolean |
containsNumbers(java.lang.String theText)
Return true if the text contains numbers.
|
static boolean |
containsSymbols(java.lang.String theText)
Return true if the text contains symbols.
|
static boolean |
containsTerm(java.lang.String theText,
java.lang.String searchTerm,
boolean exactMatch,
boolean caseSensitive)
Return true if the text sequence contains the search term.
|
static boolean |
containsWhiteSpace(java.lang.String theText)
Return true if the text contains any whitespace characters.
|
static java.util.ArrayList<java.lang.String> |
createWordList(java.util.ArrayList<java.lang.String> wordList)
Create a full word list from the list entered.
|
static java.util.ArrayList<java.lang.String> |
createWordListLC(java.util.ArrayList<java.lang.String> wordList)
Create a full lower case word list from the list entered.
|
static boolean |
isNumerical(java.lang.String theText)
Return true if the text is numerical.
|
static boolean |
isStartSentence(java.lang.String endChars,
java.lang.String theText)
Return true if the text is the start of a new sentence.
|
static boolean |
isSymbol(char theText)
Return true if the text is a symbol, excluding characters and numbers.
|
static boolean |
isUpperCase(char theChar)
Return true if the character is upper case.
|
static boolean |
isWhitespace(java.lang.String theText)
Return true if the text is all whitespace.
|
static java.lang.String |
removeNumbers(java.lang.String theText)
Remove all numbers from the text.
|
static java.lang.String |
removePunctuation(java.lang.String theText)
Remove punctuation from the text.
|
static java.lang.String |
removeSymbols(java.lang.String theText,
boolean wordRules)
Remove all symbols from the text.
|
static java.lang.String |
removeToNextWhitespace(java.lang.String theText,
int position)
Remove a text sequence to the next whitespace character.
|
static java.lang.String |
removeWords(java.lang.String theText,
java.util.ArrayList<java.lang.String> wordList)
Remove all words that are in the list of common words.
|
static java.lang.String |
replaceSymbolsWithWhitespace(java.lang.String theText,
boolean wordRules)
Replace all symbols in the text with whitespace.
|
static java.lang.String |
singleLine(java.lang.String theText)
Convert the text back to a single line of text.
|
static java.lang.String |
singleList(java.lang.String theText)
Create a single list of words from the text input.
|
static java.util.ArrayList<java.lang.String> |
singleListVec(java.lang.String theText)
Create a single list of words from the text input.
|
static java.lang.String |
singleSpaces(java.lang.String theText)
Remove double or more spaces between words.
|
static boolean |
startsWithCapitol(java.lang.String theWord)
Return true if the word starts with a capitol letter.
|
static java.lang.String |
trimNumber(java.lang.String theSymbol,
boolean keepNegative)
Trim a potential number value by removing all non-numerical characters
from the start or the end of the string value.
|
static java.lang.String |
trimSymbols(java.lang.String theText)
Trim all symbols from the start or the end of the text string.
|
public static final java.lang.String NODESCRIPTION
public static final java.lang.String INDENT
public static boolean isUpperCase(char theChar)
theChar - the character to check.public static boolean isNumerical(java.lang.String theText)
theText - the text to check.public static boolean isSymbol(char theText)
theText - the text to check.public static boolean isStartSentence(java.lang.String endChars,
java.lang.String theText)
throws java.lang.Exception
endChars - the last characters of the previous sentence. This must be
quotes of some sort and then a full stop, or a full stop directly.theText - the new text to check. This can be whitespace and punctuation (symbols)
followed by a capitol letter, or a capitol letter immediately.java.lang.Exception - any error.public static boolean startsWithCapitol(java.lang.String theWord)
throws java.lang.Exception
theWord - the word to check.java.lang.Exception - any error.public static boolean containsTerm(java.lang.String theText,
java.lang.String searchTerm,
boolean exactMatch,
boolean caseSensitive)
theText - the text to process.searchTerm - the term to search for.exactMatch - if true an exact non-case sensitive match is required. If
false only a non-case sensitive sequence anywhere in the text is required.caseSensitive - if true case is also considered.public static boolean containsLetters(java.lang.String theText)
theText - the text to check.public static boolean containsNumbers(java.lang.String theText)
theText - the text to check.public static boolean containsSymbols(java.lang.String theText)
theText - the text to check.public static boolean containsWhiteSpace(java.lang.String theText)
theText - the text to check.public static boolean isWhitespace(java.lang.String theText)
theText - the text to check.public static java.lang.String removeSymbols(java.lang.String theText,
boolean wordRules)
throws java.lang.Exception
removePunctuation method for removing only full stops,
commas, etc. automatically.theText - the input text.wordRules - if true then apply an extra set of separation rules that can also
keep some of the symbols. If false then all symbols are automatically removed.java.lang.Exception - any error.public static java.lang.String removePunctuation(java.lang.String theText)
removeSymbols or replaceSymbolsWithWhitespace
and so are not removed.theText - th text to process.public static java.lang.String replaceSymbolsWithWhitespace(java.lang.String theText,
boolean wordRules)
throws java.lang.Exception
removePunctuation method for full stops, commas, etc.theText - the input text.wordRules - if true apply the extra separation rules. If false just
perform an automatic symbol replacement.java.lang.Exception - any error.public static java.lang.String removeToNextWhitespace(java.lang.String theText,
int position)
theText - the text to process.position - the position to start from. Can be 0 or less for the start of the string.public static java.lang.String removeNumbers(java.lang.String theText)
throws java.lang.Exception
theText - the input text.java.lang.Exception - any error.public static java.lang.String trimNumber(java.lang.String theSymbol,
boolean keepNegative)
throws java.lang.Exception
theSymbol - the input text sequence - single word or symbol.keepNegative - if true, try to keep the negative 'minus' sign.java.lang.Exception - any error.public static java.lang.String trimSymbols(java.lang.String theText)
throws java.lang.Exception
theText - the text string.java.lang.Exception - any error.public static java.lang.String removeWords(java.lang.String theText,
java.util.ArrayList<java.lang.String> wordList)
theText - the input text.wordList - the list of words to remove.public static java.lang.String singleList(java.lang.String theText)
theText - the input text.public static java.util.ArrayList<java.lang.String> singleListVec(java.lang.String theText)
theText - the input text.public static java.lang.String singleLine(java.lang.String theText)
theText - the input text.public static java.lang.String singleSpaces(java.lang.String theText)
theText - the input text.public static java.util.ArrayList<java.lang.String> createWordList(java.util.ArrayList<java.lang.String> wordList)
wordList - the word list entered.public static java.util.ArrayList<java.lang.String> createWordListLC(java.util.ArrayList<java.lang.String> wordList)
wordList - the word list entered.