|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.melati.poem.util.StringUtils
public class StringUtils
An assortment of useful operations on Strings.
Should be a final class, but it is extended in org.melati.util.
| Constructor Summary | |
|---|---|
protected |
StringUtils()
|
| Method Summary | |
|---|---|
static void |
appendEscaped(java.lang.StringBuffer b,
java.lang.String s,
char character)
|
static void |
appendEscaped(java.lang.StringBuffer b,
java.lang.String s,
char character,
char escapeChar)
Append a String to a StringBuffer, and escaping any occurances of the char in the String. |
static void |
appendQuoted(java.lang.StringBuffer b,
java.lang.String s,
char q)
Append a String to a StringBuffer, first quoting it with a quote character and escaping any occurances of the quote char in the String. |
static java.lang.String |
capitalised(java.lang.String name)
Captialise the first character of the input string. |
static java.lang.String |
concatenated(java.lang.String sep,
java.lang.String[] xs)
Concatenate an array of Strings with a separator. |
static byte |
hexDecoding(char c)
Decode a hex char to a byte. |
static byte[] |
hexDecoding(java.lang.String digits)
Decode a hex String into a byte Array. |
static java.lang.String |
hexEncoding(byte[] bytes)
Hex encode an Array of bytes. |
static boolean |
isQuoted(java.lang.String in)
Determine whether a String is quoted, with either quoting character. |
static java.lang.String |
nulled(java.lang.String s)
Turn an empty String into a null. |
static java.lang.String |
quoted(java.lang.String i,
char q)
Surround a string in quotes. |
static java.lang.String |
randomString(int length)
Generate a random String. |
static java.lang.String[] |
split(java.lang.String s,
char c)
As Perl, create an Array from a String by using a character as the Array delimiter. |
static java.lang.String |
tr(java.lang.String s,
char from,
char to)
As Perl tr; swap any occurances of the
from character in the input string with the
corresponding the to character. |
static java.lang.String |
tr(java.lang.String s,
java.lang.String from,
java.lang.String to)
As Perl tr; swap any occurances of any characters in the
from string in the input string with the
corresponding character from the to string. |
static java.lang.String |
uncapitalised(java.lang.String name)
Uncaptialise the first character of the input string. |
static java.lang.String |
unNulled(java.lang.String in)
Turn a null into an empty String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected StringUtils()
| Method Detail |
|---|
public static java.lang.String[] split(java.lang.String s,
char c)
s - the String to splitc - the Array delimiter
public static void appendEscaped(java.lang.StringBuffer b,
java.lang.String s,
char character)
b - the buffer to append tos - the String to appendcharacter - the character to escape
public static void appendEscaped(java.lang.StringBuffer b,
java.lang.String s,
char character,
char escapeChar)
b - the buffer to append tos - the String to appendcharacter - the character to escapeescapeChar - the character to escape with
public static void appendQuoted(java.lang.StringBuffer b,
java.lang.String s,
char q)
b - the buffer to append tos - the String to appendq - the quote character
public static java.lang.String quoted(java.lang.String i,
char q)
i - the string to quoteq - The quote character to use
public static java.lang.String capitalised(java.lang.String name)
name - String to capitalise
public static java.lang.String uncapitalised(java.lang.String name)
name - String to uncapitalise
public static java.lang.String tr(java.lang.String s,
java.lang.String from,
java.lang.String to)
tr; swap any occurances of any characters in the
from string in the input string with the
corresponding character from the to string.
tr("melati", "ait", "osn").equals("melons")
s - String to act uponfrom - String containing characters to swap fromto - String containing characters to swap to
public static java.lang.String tr(java.lang.String s,
char from,
char to)
tr; swap any occurances of the
from character in the input string with the
corresponding the to character.
tr("melati", 'i', 'o').equals("melato")
s - String to act uponfrom - character to swap fromto - character to swap to
public static java.lang.String concatenated(java.lang.String sep,
java.lang.String[] xs)
sep - The separator String to use, may be null.xs - An array of Strings to concatenate.
public static java.lang.String randomString(int length)
length - the required length of the String returned
public static java.lang.String nulled(java.lang.String s)
s - input String, possibly of zero length or null
public static java.lang.String unNulled(java.lang.String in)
in - input String, possibly null
public static java.lang.String hexEncoding(byte[] bytes)
bytes - the byte Array
public static byte hexDecoding(char c)
c - the char
public static byte[] hexDecoding(java.lang.String digits)
digits - the hex String
public static boolean isQuoted(java.lang.String in)
in - String to examine
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||