public class TextTools
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TextTools.ClsStringWidthAndLines
The Class ClsStringWidthAndLines.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
styles
The Constant styles.
|
Constructor and Description |
---|
TextTools() |
Modifier and Type | Method and Description |
---|---|
static void |
addAfterSpacer(java.lang.StringBuilder sb,
java.lang.String string,
java.lang.String spacer)
Adds the after spacer.
|
static java.lang.String |
addStylesToHTMLString(java.lang.String html)
Adds the styles to HTML string.
|
static TextTools.ClsStringWidthAndLines |
computeStringMultilineWidth(java.awt.FontMetrics fm,
java.lang.String text)
Compute the width of the string using a font with the specified
"metrics" (sizes).
|
static java.lang.String |
convertNumToColString(int col)
Takes in a 0-based base-10 column and returns a ALPHA-26
representation.
|
static java.util.Map<java.lang.String,java.lang.String> |
eliminateCommon(java.util.Collection<java.lang.String> input)
Prepares a Map of strings that contains the unique parts of each string
in the overall collection.
|
static boolean |
equalsNullSafe(java.lang.Object obj1,
java.lang.Object obj2)
Compares two objects that implements equals and return true if both are null
or both are equals using equals on the one that is not null or in obj1 if both
are not null.
|
static java.lang.String |
extractNumber(java.lang.String strValueFormatted)
This method will extract a number form the text string received as a parameter by removing
all non number characters except the dot "."
|
static java.lang.String |
getSignAndDigits(java.lang.CharSequence cs)
Returns the optional minus sign and all digits from the left of the incoming CharSequence
and ignores other characters that are not digits.
|
static java.lang.String |
htmlToText(java.lang.String inputHTML)
Very simple transformation between HTML and Text.
|
static boolean |
isHTML(java.lang.String text)
Returns true if text is html.
|
static int |
leftCollectToSpaceUnquoting(java.lang.String address,
int atChar,
java.lang.StringBuilder buffer)
Used to extract the user name form an email address.
|
static java.lang.String |
lowerFirstWord(java.lang.String inputStr)
Lower first word.
|
static java.lang.String |
md5(java.lang.String source)
Compute md5 of the input text.
|
static java.lang.String |
normalizeSpace(java.lang.String source)
Returns a string with space normalized.
|
static java.lang.String |
normalizeSpaces(java.lang.String text)
Replaces multiple occurrences of spaces and invisible characters by
a single space.
|
static java.lang.String |
pluralize(java.lang.String text,
double days)
Pluralize.
|
static java.lang.String |
randomString(int len)
Generates a random string of the indicated length.
|
static java.lang.String |
reencodeText(java.lang.String possibleHTMLtext)
Re encode a text string according with the rules defined in the EFM.
|
static java.lang.String |
replaceEncodingInformation(java.lang.String inputHTML,
java.lang.String instanceEncoding)
This method is used to replace definitions of charcodes to match the charcode of the
XBRL instance to be serialized.
|
static int |
reverseFind(java.lang.String string,
char c,
int i)
Finds character
c on the string string starting at character position i
decrementing the character position |
static int |
rightCollectToSpaceUnquoting(java.lang.String address,
int atChar,
java.lang.StringBuilder buffer)
Right collect to space unquoting.
|
static boolean |
search(java.lang.String where,
java.lang.String find,
boolean bExactWord,
boolean ignoreCase)
This method search the 'find' parameter string in 'where' parameter string.
|
static java.lang.String |
textToHTML(java.lang.String inputStr)
Very simple transformation of a text string with carrier returns into an HTML text with
<br/> separators.
|
static java.lang.String |
textToHTMLtext(java.lang.String string)
This is the surrounding method behind
textToHTML(String) . |
static java.lang.String |
toHTMLTooltip(java.lang.String inputStr)
Very simple transformation of a text string with carrier returns into an HTML text with
<br/> separators.
|
static java.lang.String |
trimToLetterOrDigit(java.lang.String text)
Remove non letter or digit to the left and right of the text received as a parameter.
|
static java.lang.String |
unquote(java.lang.String text)
Removes starting and ending quote marks of a string if they exist.
|
static java.lang.String |
upperFirstLetter(java.lang.String string)
Simple text transformation to capitalize the first letter in the string.
|
public static java.lang.String lowerFirstWord(java.lang.String inputStr)
inputStr
- the input strpublic static boolean isHTML(java.lang.String text)
text
- the textpublic static java.lang.String toHTMLTooltip(java.lang.String inputStr)
inputStr
- input string as text.public static java.lang.String textToHTML(java.lang.String inputStr)
inputStr
- input string as text.public static java.lang.String textToHTMLtext(java.lang.String string)
textToHTML(String)
.string
- the stringtextToHTML(String)
public static java.lang.String htmlToText(java.lang.String inputHTML)
inputHTML
- the input htmlpublic static java.lang.String upperFirstLetter(java.lang.String string)
string
- the stringpublic static java.lang.String pluralize(java.lang.String text, double days)
text
- the textdays
- the dayspublic static void addAfterSpacer(java.lang.StringBuilder sb, java.lang.String string, java.lang.String spacer)
sb
- the sbstring
- the stringspacer
- the spacerpublic static java.lang.String getSignAndDigits(java.lang.CharSequence cs)
cs
- the cspublic static java.lang.String reencodeText(java.lang.String possibleHTMLtext)
possibleHTMLtext
- the possible htm ltextpublic static java.lang.String md5(java.lang.String source)
source
- the input textpublic static java.lang.String replaceEncodingInformation(java.lang.String inputHTML, java.lang.String instanceEncoding)
inputHTML
- incoming html page with encodings that might not match instanceEncodinginstanceEncoding
- the encoding used in the output instance, normally this is UTF-8public static TextTools.ClsStringWidthAndLines computeStringMultilineWidth(java.awt.FontMetrics fm, java.lang.String text)
fm
- a FontMetrics object to compute withtext
- the textpublic static java.lang.String extractNumber(java.lang.String strValueFormatted)
strValueFormatted
- the str value formattedpublic static boolean search(java.lang.String where, java.lang.String find, boolean bExactWord, boolean ignoreCase)
where
- the wherefind
- the findbExactWord
- the b exact wordignoreCase
- the ignore casepublic static java.util.Map<java.lang.String,java.lang.String> eliminateCommon(java.util.Collection<java.lang.String> input)
input
- the inputpublic static int leftCollectToSpaceUnquoting(java.lang.String address, int atChar, java.lang.StringBuilder buffer)
address
- the addressatChar
- the at charbuffer
- the bufferpublic static int rightCollectToSpaceUnquoting(java.lang.String address, int atChar, java.lang.StringBuilder buffer)
address
- the addressatChar
- the at charbuffer
- the bufferpublic static java.lang.String unquote(java.lang.String text)
text
- the textpublic static java.lang.String trimToLetterOrDigit(java.lang.String text)
text
- to trimpublic static boolean equalsNullSafe(java.lang.Object obj1, java.lang.Object obj2)
obj1
- first object to compare or nullobj2
- second object to compare or nullpublic static java.lang.String normalizeSpace(java.lang.String source)
Character eliminated are defined by a regular expression
source
- to normalize as Stringpublic static java.lang.String randomString(int len)
len
- string length desiredpublic static java.lang.String convertNumToColString(int col)
col
- the colpublic static int reverseFind(java.lang.String string, char c, int i)
c
on the string string
starting at character position i
decrementing the character positionstring
- source textc
- character to findi
- starting positionpublic static java.lang.String addStylesToHTMLString(java.lang.String html)
html
- the htmlpublic static java.lang.String normalizeSpaces(java.lang.String text)
text
- the textCopyright 2006-2015 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa