|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.webmacro.ContextTool
org.webmacro.servlet.TextTool
A ContextTool for String manipulation.
Constructor Summary | |
TextTool()
default contsructor. |
|
TextTool(Context context)
public constructor. |
Method Summary | |
static java.lang.String |
bytesToString(byte[] bytes)
convert a byte[] to a String using the system-default
encoding |
static java.lang.String |
bytesToString(byte[] bytes,
java.lang.String encoding)
convert a byte[] to a String using the specified
encoding |
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String format)
Format a java.util.Date object using the specified date
format string. |
static TextTool |
getInstance()
|
static java.lang.String[] |
getLines(java.lang.String block)
converts a block of text into an array of strings by tokenizing using \r\n as the delimiter If no \r\n, it will look for \n or \r and use them instead. |
static java.lang.String |
HTMLEncode(java.lang.String input)
HTMLEncode will encode the specified input String
per the magic of org.webmacro.util.HTMLEscaper . |
java.lang.Object |
init(Context context)
Tool initialization method. |
static java.lang.String |
join(java.lang.String[] input,
java.lang.String delimiter)
Join the input String[] into a single String, using
the specified delimiter between each value of the array. |
static java.lang.String |
ltrim(java.lang.String s)
remove any leading whitespace from a string |
static java.lang.String |
ltrimBlock(java.lang.String block)
remove the leading whitespace from each line in a block of text |
static void |
main(java.lang.String[] args)
|
static java.lang.String |
makeBlock(java.lang.String[] lines)
convert an array of strings into a block of text delimited by \r\n |
static java.lang.String |
replace(java.lang.String src,
java.lang.String from,
java.lang.String to)
replace all occurrences of from to to
in src . |
static java.lang.String |
rtrim(java.lang.String s)
remove the trailing whitespace from a string |
static java.lang.String |
rtrimBlock(java.lang.String block)
remove the trailing whitespace from each line in a block of text |
static java.lang.String[] |
split(java.lang.String input,
java.lang.String delimiter)
Split the input String into a String[] at each
instance of delimiter . |
static java.lang.String |
streamToString(java.io.InputStream in)
Write the bytes of the specified InputStream into a String using the default character encoding of your platform. |
static java.lang.String |
streamToString(java.io.InputStream in,
java.lang.String encoding)
Write the bytes of the specified InputStream into a String using the specified character encoding. |
static java.lang.String |
toLowerCase(java.lang.String s)
Returns a new string which is in lower case. |
static java.lang.String |
toUpperCase(java.lang.String s)
Returns a new string which is in upper case. |
static java.lang.String |
trim(java.lang.String s)
remove any leading and trailing whitespace from a string |
static java.lang.String |
trimBlock(java.lang.String block)
remove the leading and trailing whitespace from each line in a block of text |
static java.lang.String |
URLDecode(java.lang.String input)
Decode a URLEncoded input String. |
static java.lang.String |
URLEncode(java.lang.String input)
URLEncode the specified input String. |
Methods inherited from class org.webmacro.ContextTool |
get |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TextTool()
public TextTool(Context context)
Method Detail |
public static TextTool getInstance()
public static java.lang.String[] split(java.lang.String input, java.lang.String delimiter)
input
String into a String[] at each
instance of delimiter
. The delimiter string is not
included in the returned array.
If either parameter is null
, split()
returns
a String[] of zero elements.
public static java.lang.String join(java.lang.String[] input, java.lang.String delimiter)
input
String[] into a single String, using
the specified delimiter
between each value of the array.
If either parameter is null
, join()
returns
null
.
public static java.lang.String replace(java.lang.String src, java.lang.String from, java.lang.String to)
from
to to
in src
.
If any paramer is null
, replace()
returns
the value of src
.
from
replaced with
to
in src
or src
if
from
not foundpublic static java.lang.String URLEncode(java.lang.String input)
input
String.
If input
is null
, URLEncode()
will return null
.
URLEncoder
public static java.lang.String URLDecode(java.lang.String input)
input
String.
If input
is null
, URLEncode()
will return null
.
URLDecoder
public static java.lang.String HTMLEncode(java.lang.String input)
input
String
per the magic of org.webmacro.util.HTMLEscaper
.
If the input
is null
, HTMLEncode()
will return an empty string
.
HTMLEscaper
public static java.lang.String formatDate(java.util.Date date, java.lang.String format)
java.util.Date
object using the specified date
format string.
Date
,
SimpleDateFormat
public static java.lang.String streamToString(java.io.InputStream in) throws java.io.IOException
java.io.IOException
- if the stream cannot be readpublic static java.lang.String streamToString(java.io.InputStream in, java.lang.String encoding) throws java.io.IOException
java.io.IOException
- if the stream cannot be readpublic static java.lang.String bytesToString(byte[] bytes)
byte[]
to a String using the system-default
encoding
public static java.lang.String bytesToString(byte[] bytes, java.lang.String encoding) throws java.io.UnsupportedEncodingException
byte[]
to a String using the specified
encoding
java.io.UnsupportedEncodingException
public static java.lang.String trim(java.lang.String s)
public static java.lang.String ltrim(java.lang.String s)
public static java.lang.String rtrim(java.lang.String s)
public static java.lang.String[] getLines(java.lang.String block)
public static java.lang.String makeBlock(java.lang.String[] lines)
public static java.lang.String trimBlock(java.lang.String block)
public static java.lang.String ltrimBlock(java.lang.String block)
public static java.lang.String rtrimBlock(java.lang.String block)
public static java.lang.String toUpperCase(java.lang.String s)
public static java.lang.String toLowerCase(java.lang.String s)
public java.lang.Object init(Context context) throws PropertyException
context
parameter is ignored.
init
in class ContextTool
PropertyException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |