public class StringHelpers extends Object
Constructor and Description |
---|
StringHelpers() |
Modifier and Type | Method and Description |
---|---|
static String |
doubleEscapeHTML(ResultSet rs,
String parameterName,
String modeValue)
Carry out the HTML escaping of a string twice.
|
static String |
doubleEscapeHTML(String value)
Carry out the HTML escaping of a string twice.
|
static String |
doubleEscapeHTML(String value,
String modeValue)
Carry out the HTML escaping of a string twice.
|
static String |
escapeHTML(ResultSet rs,
String parameterName)
Processes special characters in HTML code so that it will
not be interpreted by browser as commands.
|
static String |
escapeHTML(ResultSet rs,
String parameterName,
String mode)
Processes special characters in HTML code so that it will
not be interpreted by browser as commands.
|
static String |
escapeHTML(String value)
Replace less than signs, greater than signs, and ampersands in a
string with their HTML representations.
|
static String |
escapeHTML(String value,
String modeValue)
Replace less than signs, greater than signs, and ampersands in a
string with their HTML representations.
|
static boolean |
isAlphanumericOnly(String value)
Returns true if and only if all of the characters in
the string are alphanumeric.
|
static boolean |
isDigitsOnly(String value)
Returns true if the string is only composed of numeric
digits.
|
static void |
main(String[] args)
Test driver.
|
static String |
padLeft(String value,
int size)
Pads a string with blanks to the left so that it has
a specified size.
|
static String |
padRight(String value,
int size)
Pads a string with blanks to the right so that it has
a specified size.
|
static void |
printJustified(GenericPrinter output,
String value) |
protected static void |
printJustified(GenericPrinter output,
String value,
int length)
Send a string to an output device, inserting line breaks at the
first space after a specified number of characters on the line.
|
static void |
printJustified(PrintStream output,
String value) |
static void |
printJustified(PrintStream output,
String value,
int length) |
static void |
printJustified(PrintWriter output,
String value) |
static void |
printJustified(PrintWriter output,
String value,
int length) |
static void |
printJustified(String value) |
static void |
printJustified(String value,
int length) |
public StringHelpers()
public static String padRight(String value, int size)
value
- String to be paddedsize
- Desired size of padded stringpublic static String padLeft(String value, int size)
value
- String to be paddedsize
- Desired size of padded stringpublic static boolean isDigitsOnly(String value)
value
- String to be evaluatedpublic static boolean isAlphanumericOnly(String value)
value
- String to be evaluatedpublic static void printJustified(String value)
public static void printJustified(String value, int length)
public static void printJustified(PrintStream output, String value)
public static void printJustified(PrintWriter output, String value)
public static void printJustified(GenericPrinter output, String value)
public static void printJustified(PrintStream output, String value, int length)
public static void printJustified(PrintWriter output, String value, int length)
protected static void printJustified(GenericPrinter output, String value, int length)
output
- Output devicevalue
- String to be sent to outputlength
- Number of characters on a line after which the next space
is to be replaced by a line feed.public static String escapeHTML(String value)
value
- String to be modifiedpublic static String doubleEscapeHTML(String value)
value
- String to be escapedpublic static String doubleEscapeHTML(String value, String modeValue)
value
- String to be escapedmodeValue
- Mode of escapingpublic static String doubleEscapeHTML(ResultSet rs, String parameterName, String modeValue)
rs
- Result set containing valueparameterName
- Name of column in result setmodeValue
- Type of processing for escapingpublic static String escapeHTML(String value, String modeValue)
If mode is TEXTAREA or TEXT, do not replace line breaks. When escaping the contents of a TEXTAREA tag, the new line and carriage return characters should remain unchanged so that they are properly represented in the form.
value
- String to be modifiedmodeValue
- Mode of operationpublic static String escapeHTML(ResultSet rs, String parameterName, String mode)
Uses @{link escapeHTML(String, String)
.
rs
- Result set containing value.parameterName
- Name of column containing valuemode
- Mode of processing to be usedpublic static String escapeHTML(ResultSet rs, String parameterName)
Uses @{link escapeHTML(String)
.
rs
- Result set containing value.parameterName
- Name of column containing value