java.lang.Objectjavax.baja.nre.util.TextUtil
Text utilities.
| Constructor Summary | |
TextUtil()
|
|
| Method Summary | |
static java.lang.String |
bytesToHexString(byte[] bs)
|
static char |
byteToChar(int b,
char unprintable)
Translate the byte into an ASCII char if it is printable. |
static java.lang.String |
byteToHexString(int b)
|
static java.lang.String |
byteToString(int b)
|
static java.lang.String |
capitalize(java.lang.String s)
Capitalize a string using java bean conventions. |
static int |
charToInt(char c)
Convert a character to a digit. |
static java.lang.String |
decapitalize(java.lang.String s)
Decapitalize a string using java bean conventions. |
static java.lang.String[] |
ensureCapacity(java.lang.String[] x,
int len)
Ensure the given string has the specified capacity. |
static java.lang.String |
fromFriendly(java.lang.String s)
Translate a friendly string back into its programatic name. |
static java.lang.String |
getClassName(java.lang.Class cls)
Get the simple classname without the package name. |
static java.lang.String |
getClassName(java.lang.String className)
Get the simple classname without the package name, and if an array type, then strip off the trailing semicolon. |
static java.lang.String |
getPackageName(java.lang.Class cls)
Get the package name. |
static java.lang.String |
getPackageName(java.lang.String className)
Get the package name from a fully qualified classname. |
static java.lang.String |
getSpaces(int num)
Get a string which is a number of spaces. |
static java.lang.String |
getZeros(int num)
Get a string which is a number of zeros. |
static int |
hexCharToInt(char c)
Convert the given hex character to a digit. |
static int |
indexOf(java.lang.StringBuffer buffer,
java.lang.String pattern)
Returns the index within the StringBuffer of the first occurrence of the specified substring. |
static int |
indexOf(java.lang.StringBuffer buffer,
java.lang.String pattern,
int fromIndex)
Returns the index within the StringBuffer of the first occurrence of the specified substring, starting at the specified index. |
static java.lang.String |
intToHexString(int i)
|
static java.lang.String |
intToHexString(int i,
int len)
|
static boolean |
isHex(java.lang.String str)
check if all the characters in a given string are hexidecimal, i.e [0-9], [A-F] |
static java.lang.String |
join(java.lang.String[] v,
char delim)
Join an array into a string, using a given delimiter. |
static java.lang.String |
pad(java.lang.String s,
int width)
Pad to the right. |
static java.lang.String |
padLeft(java.lang.String s,
int width)
Pad the given string with spaces to the left so that it is the given width. |
static java.lang.String |
padRight(java.lang.String s,
int width)
Pad the given string with spaces to the right so that it is the given width. |
static java.lang.String |
padZeros(java.lang.String s,
int width)
Pad the given string with zeros to the left so that it is the given width. |
static java.lang.StringBuffer |
replace(java.lang.StringBuffer text,
java.lang.String oldStr,
java.lang.String newStr)
Replace, in the given text buffer, all occurences of the old string with the new string. |
static java.lang.String |
replace(java.lang.String text,
java.lang.String oldStr,
java.lang.String newStr)
Replace, in the given text, all occurences of the old string with the new string. |
static java.lang.String[] |
split(java.lang.String str,
char delim)
Parse a string into an array, using a given delimiter. |
static java.lang.String[] |
splitAndTrim(java.lang.String str,
char delim)
Parse a string into an array, using a given delimiter, and trim the whitespace from ends each string. |
static byte[] |
stringToBytes(java.lang.String string)
Convert the passed in String to a byte array by taking the bottom 8 bits of each character it contains. |
static java.lang.String |
stripMarkup(java.lang.String text)
Strip all the XML or HTML markup out of a piece of text and return the plain text. |
static java.lang.String |
toFriendly(java.lang.String s)
Translate a programatic name to a friendly name. |
static char |
toLowerCase(char c)
Do an ASCII only lower case conversion. |
static java.lang.String |
toLowerCase(java.lang.String s)
Do an ASCII only lower case conversion. |
static char |
toUpperCase(char c)
Do an ASCII only upper case conversion. |
static java.lang.String |
toUpperCase(java.lang.String s)
Do an ASCII only upper case conversion. |
static java.lang.String[] |
trim(java.lang.String[] list)
Trim all the Strings in the specified array. |
static java.lang.String |
trimLeft(java.lang.String s)
Trim the whitespace from the beginning of a string. |
static java.lang.String |
trimRight(java.lang.String s)
Trim the whitespace from the end of a string. |
static java.lang.String |
truncate(java.lang.String str,
int max)
Ensure that the given string is no more than 'max' characters long. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TextUtil()
| Method Detail |
public static byte[] stringToBytes(java.lang.String string)
string - the string to be converted
public static java.lang.String byteToString(int b)
public static java.lang.String bytesToHexString(byte[] bs)
public static java.lang.String byteToHexString(int b)
public static char byteToChar(int b,
char unprintable)
public static java.lang.String intToHexString(int i)
public static java.lang.String intToHexString(int i,
int len)
public static int charToInt(char c)
public static int hexCharToInt(char c)
public static boolean isHex(java.lang.String str)
public static java.lang.String getSpaces(int num)
public static java.lang.String pad(java.lang.String s,
int width)
padRight(String, int)
public static java.lang.String padRight(java.lang.String s,
int width)
public static java.lang.String padLeft(java.lang.String s,
int width)
public static java.lang.String truncate(java.lang.String str,
int max)
public static java.lang.String padZeros(java.lang.String s,
int width)
public static java.lang.String getZeros(int num)
public static char toUpperCase(char c)
public static char toLowerCase(char c)
public static java.lang.String toUpperCase(java.lang.String s)
public static java.lang.String toLowerCase(java.lang.String s)
public static java.lang.String capitalize(java.lang.String s)
public static java.lang.String decapitalize(java.lang.String s)
public static java.lang.String toFriendly(java.lang.String s)
public static java.lang.String fromFriendly(java.lang.String s)
public static java.lang.String getClassName(java.lang.Class cls)
public static java.lang.String getClassName(java.lang.String className)
public static java.lang.String getPackageName(java.lang.Class cls)
public static java.lang.String getPackageName(java.lang.String className)
public static java.lang.String stripMarkup(java.lang.String text)
public static java.lang.String[] split(java.lang.String str,
char delim)
public static java.lang.String[] splitAndTrim(java.lang.String str,
char delim)
public static java.lang.String[] ensureCapacity(java.lang.String[] x,
int len)
public static java.lang.String[] trim(java.lang.String[] list)
public static java.lang.String join(java.lang.String[] v,
char delim)
public static java.lang.String trimLeft(java.lang.String s)
public static java.lang.String trimRight(java.lang.String s)
public static java.lang.String replace(java.lang.String text,
java.lang.String oldStr,
java.lang.String newStr)
java.lang.NullPointerException - - if text, oldStr or newStr are null.
public static java.lang.StringBuffer replace(java.lang.StringBuffer text,
java.lang.String oldStr,
java.lang.String newStr)
java.lang.NullPointerException - - if text, oldStr or newStr are null.
public static int indexOf(java.lang.StringBuffer buffer,
java.lang.String pattern)
java.lang.NullPointerException - - if buffer or str is null.
public static int indexOf(java.lang.StringBuffer buffer,
java.lang.String pattern,
int fromIndex)
There is no restriction on the value of fromIndex. If it is negative, it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string, it has the same effect as if it were equal to the length of this string: -1 is returned.
java.lang.NullPointerException - - if buffer or str is null.Copyright © 2000-2016 Tridium Inc. All rights reserved.