|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.util.UtlText
public class UtlText
Utilities for manipulating Text.
This class IS NOT intended to be used by end users.
Constructor Summary | |
---|---|
UtlText()
|
Method Summary | |
---|---|
static String |
bytesToHexString(byte[] bytes)
Encodes input byte array as String of hexadecimal digits. |
static String |
deCamelCase(String camelCase)
Takes a camel case string and splits into to a space separated string |
static byte[] |
hexToBytes(String hexString)
Converts a hexadecimal string to a byte array after first stripping an spaces from the provided text. |
static boolean |
isNullOrEmpty(String text)
|
static String |
quoteAndEscape(String string)
If the given string contains spaces quote it and escape an inner quotes in the sting. |
static String |
readFully(InputStream input,
String charset)
Reads an InputStream fully as a string. |
static String |
removeLineBreaks(String text)
Removes line breaks for the given text, replacing breaks with a single space. |
static String[] |
retokenizeWithQuotes(StringTokenizer tokenizer,
boolean preserveInnerEscapes)
Given a StringTokenizer this method concatenates all tokens into a string delimited by a single space. |
static LinkedList<String> |
splitCamelCaseString(String s)
accept a string, like aCamelString and return a list containing strings, in this case, [a, Camel, String] |
static boolean |
startsWithIgnoreCase(String text,
String prefix)
Indicates whether the provided text begins with the prefix, without regard for capitalization. |
static String |
stripQuotesAndUnescape(String string)
Strips leading and trailing quotes from the given string, if the String starts with a leading '"' character, and unescapes any escaped '"' within the quoted string. |
static String |
toCamelCase(String text,
boolean includeFirstLetter)
Converts text to camel case. |
static String |
toFirstLetterLowercase(String str)
Returns a string with lowercase first letter. |
static String |
toFirstLetterUppercase(String str)
Returns a string with uppercases first letter. |
static double |
uniformMetric(String text)
Map a string to it's location in a uniform distribution of text, with resulting value between 0.0 and 1.0, excluding 1.0 itself. |
static String |
upperCaseFirstLetters(String str)
Changes the first letter of each word in the provided string to uppercase. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UtlText()
Method Detail |
---|
public static double uniformMetric(String text)
text
- The text to examine.
public static String toFirstLetterUppercase(String str)
str
- The string
public static String toFirstLetterLowercase(String str)
str
- The string
public static boolean startsWithIgnoreCase(String text, String prefix)
text
- The text to examine.prefix
- The prefix to check for.
true if the text starts with the prefix.
public static boolean isNullOrEmpty(String text)
text
- to check.
public static String removeLineBreaks(String text)
text
- The text from which to remove line breaks.
public static String toCamelCase(String text, boolean includeFirstLetter)
text
- the text to be camelcased.includeFirstLetter
- Whether or not to uppercase the first letter or leave it as is.
public static final String deCamelCase(String camelCase)
camelCase
- The camel case input
public static String upperCaseFirstLetters(String str)
str
- The str to augment.
public static LinkedList<String> splitCamelCaseString(String s)
s
- The str to split.
public static final byte[] hexToBytes(String hexString)
hexString
- The hex encoded string.
public static final String bytesToHexString(byte[] bytes)
bytes
- Array to convert.
public static final String[] retokenizeWithQuotes(StringTokenizer tokenizer, boolean preserveInnerEscapes)
'"' or ''' encountered within quotes can be escaped by prefixing them with a '\'. When in a quote block such tokens are either converted represented in the resulting token either with the escape preserved or removed accoring to the value of preserverInnerEscapes.
tokenizer
- The tokenizer to retokenize.preserveInnerEscapes
- If true escape characters inside of quotes are preserved
public static final String quoteAndEscape(String string)
string
- The string to quote.
public static final String stripQuotesAndUnescape(String string)
string
- The string to strip.
public static final String readFully(InputStream input, String charset) throws IOException
input
- The InputStreamcharset
- The character set to use for file content
IOException
- If there is an error reading the file
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |