|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--stomp.util.StringHelper
Utility class to help with String manipulation
Constructor Summary | |
StringHelper()
|
Method Summary | |
static java.lang.String |
capitalize(java.lang.String s)
|
static java.lang.String[] |
collectionToQuotedStrings(java.util.Collection objs)
Converts a collection of objects into an array of their string representations enclosed in quotes when the strings do not look like numbers or dates |
static java.lang.String[] |
collectionToStrings(java.util.Collection objs)
Converts a collection of objects into an array of their string representations |
static boolean |
endsWithAQuote(java.lang.String str)
Determines whether the given string ends with a quote |
static boolean |
isDate(java.lang.String suspect)
Determines whether the given string represents a date |
static boolean |
isNumber(java.lang.String suspect)
Determines whether the given string represents a number |
static java.lang.String |
join(byte[] bytes,
java.lang.String delimiter)
Glues given bytes together with the given delimiter in between the joined elements. |
static java.lang.String |
join(byte[] bytes,
java.lang.String delimiter,
int offset,
int length)
Glues given bytes together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( bytes, delimiter, 0, bytes.length) will join all the elements in the array |
static java.lang.String |
join(double[] doubles,
java.lang.String delimiter)
Glues given doubles together with the given delimiter in between the joined elements. |
static java.lang.String |
join(double[] doubles,
java.lang.String delimiter,
int offset,
int length)
Glues given doubles together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( doubles, delimiter, 0, doubles.length) will join all the elements in the array |
static java.lang.String |
join(float[] floats,
java.lang.String delimiter)
Glues given floats together with the given delimiter in between the joined elements. |
static java.lang.String |
join(float[] floats,
java.lang.String delimiter,
int offset,
int length)
Glues given floats together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( floats, delimiter, 0, floats.length) will join all the elements in the array |
static java.lang.String |
join(int[] ints,
java.lang.String delimiter)
Glues given integers together with the given delimiter in between the joined elements. |
static java.lang.String |
join(int[] ints,
java.lang.String delimiter,
int offset,
int length)
Glues given integers together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( ints, delimiter, 0, ints.length) will join all the elements in the array |
static java.lang.String |
join(long[] longs,
java.lang.String delimiter)
Glues given longs together with the given delimiter in between the joined elements. |
static java.lang.String |
join(long[] longs,
java.lang.String delimiter,
int offset,
int length)
Glues given longs together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( longs, delimiter, 0, longs.length) will join all the elements in the array |
static java.lang.String |
join(java.lang.Object[] objs,
java.lang.String delimiter)
Glues given string elements together with the given delimiter in between the joined elements. |
static java.lang.String |
join(java.lang.Object[] objs,
java.lang.String delimiter,
int offset,
int length)
Glues given string elements together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( strs, delimiter, 0, strs.length) will join all the elements in the array |
static java.lang.String |
join(short[] shorts,
java.lang.String delimiter)
Glues given shorts together with the given delimiter in between the joined elements. |
static java.lang.String |
join(short[] shorts,
java.lang.String delimiter,
int offset,
int length)
Glues given shorts together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( shorts, delimiter, 0, shorts.length) will join all the elements in the array |
static java.lang.String |
join(java.lang.String[] strs,
java.lang.String delimiter)
Glues given string elements together with the given delimiter in between the joined elements. |
static java.lang.String |
join(java.lang.String[] strs,
java.lang.String delimiter,
int offset,
int length)
Glues given string elements together with the given delimiter in between the joined elements starting with the offset element and
joining length number of elements
within the given array of elements.split( strs, delimiter, 0, strs.length) will join all the elements in the array |
static java.lang.StringBuffer |
replace(java.lang.String string,
java.lang.String find,
java.lang.String replace)
replaces all instance of find with replace and returns the resultant String in a StringBuffer |
static java.lang.String |
simpleNameOf(java.lang.Class theClass)
|
static java.lang.String |
simpleNameOf(java.lang.String name)
|
static java.lang.String[] |
split(java.lang.String str,
java.lang.String delimiter)
Parses the given string for the fields delimited by the given delimiter |
static java.lang.String[] |
split(java.lang.String str,
java.lang.String delimiter,
boolean withRegardsToQuotes)
Parses the given string for the fields delimited by the given delimiter possibly with regards for the quotes around the fields (if requested) |
static boolean |
startsWithAQuote(java.lang.String str)
Determines whether the given string starts with a quote |
static boolean |
stringArraysEqual(java.lang.String[] a,
java.lang.String[] b)
Determines if the two string arrays are equal by comparing corresponding array elements |
static java.lang.String |
stripQuotes(java.lang.String str)
Strips the beginning and ending quotes off the given string |
static java.lang.String |
wrapString(java.lang.String message,
int preferredLineLength)
Wraps the given string (by inserting new-line charactes) trying to keep line length to the given preferred line length. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StringHelper()
Method Detail |
public static java.lang.StringBuffer replace(java.lang.String string, java.lang.String find, java.lang.String replace)
public static java.lang.String capitalize(java.lang.String s)
public static java.lang.String[] split(java.lang.String str, java.lang.String delimiter)
str
- Original string to parsedelimiter
- The delimiter to distingish the fieldspublic static java.lang.String[] split(java.lang.String str, java.lang.String delimiter, boolean withRegardsToQuotes)
str
- A string to parsedelimiter
- The delimiter to distingish the fieldswithRegardsToQuotes
- Whether a special attention to quotes is neededpublic static java.lang.String join(java.lang.String[] strs, java.lang.String delimiter)
strs
- Array of string elements that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(java.lang.String[] strs, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of string elements that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String join(java.lang.Object[] objs, java.lang.String delimiter)
strs
- Array of string elements that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(java.lang.Object[] objs, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of string elements that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String join(byte[] bytes, java.lang.String delimiter)
strs
- Array of bytes that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(byte[] bytes, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of bytes that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String join(short[] shorts, java.lang.String delimiter)
strs
- Array of shorts that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(short[] shorts, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of shorts that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String join(int[] ints, java.lang.String delimiter)
strs
- Array of integers that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(int[] ints, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of integers that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String join(long[] longs, java.lang.String delimiter)
strs
- Array of longs that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(long[] longs, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of longs that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String join(float[] floats, java.lang.String delimiter)
strs
- Array of floats that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(float[] floats, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of floats that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String join(double[] doubles, java.lang.String delimiter)
strs
- Array of doubles that need to be joineddelimiter
- A delimiter to use in between the joined elementspublic static java.lang.String join(double[] doubles, java.lang.String delimiter, int offset, int length)
offset
element and
joining length
number of elements
within the given array of elements.strs
- Array of doubles that need to be joineddelimiter
- A delimiter to use in between the joined elementsoffset
- Index of the starting element to be joinedlength
- Number of elements to join from the given array
of elementspublic static java.lang.String[] collectionToStrings(java.util.Collection objs)
objs
- A collection of objectspublic static java.lang.String[] collectionToQuotedStrings(java.util.Collection objs)
objs
- A collection of objectspublic static java.lang.String stripQuotes(java.lang.String str)
str
- A string to strip the quotes offpublic static boolean startsWithAQuote(java.lang.String str)
str
- A string to examinepublic static boolean endsWithAQuote(java.lang.String str)
str
- A string to examinepublic static boolean isNumber(java.lang.String suspect)
suspect
- A string to examinepublic static boolean isDate(java.lang.String suspect)
suspect
- A string to examinepublic static boolean stringArraysEqual(java.lang.String[] a, java.lang.String[] b)
a
- First array to compareb
- Second array to comparepublic static java.lang.String simpleNameOf(java.lang.Class theClass)
public static java.lang.String simpleNameOf(java.lang.String name)
public static java.lang.String wrapString(java.lang.String message, int preferredLineLength)
message
- A string to wrappreferredLineLength
- A preferred length of lines in the wrapped string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |