public class StringUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
debug
debug flag
|
static java.lang.String[] |
ordinalNames
Ordinal names for images
|
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.StringBuffer |
append(java.lang.StringBuffer sb,
java.lang.Object s1)
A utility method to an append to a StringBuffer.
|
static java.lang.StringBuffer |
append(java.lang.StringBuffer sb,
java.lang.Object s1,
java.lang.Object s2)
A utility method to do multiple appends to a StringBuffer.
|
static java.lang.StringBuffer |
append(java.lang.StringBuffer sb,
java.lang.Object s1,
java.lang.Object s2,
java.lang.Object s3)
A utility method to do multiple appends to a StringBuffer.
|
static java.lang.StringBuffer |
append(java.lang.StringBuffer sb,
java.lang.Object s1,
java.lang.Object s2,
java.lang.Object s3,
java.lang.Object s4)
A utility method to do multiple appends to a StringBuffer.
|
static java.lang.StringBuffer |
append(java.lang.StringBuffer sb,
java.lang.Object s1,
java.lang.Object s2,
java.lang.Object s3,
java.lang.Object s4,
java.lang.Object s5)
A utility method to do multiple appends to a StringBuffer.
|
static java.lang.String |
applyMacros(java.lang.String s,
java.util.Hashtable props,
boolean throwError)
This takes a string of the following form.
|
static java.lang.String |
breakText(java.lang.String text,
java.lang.String insert,
int lineSize)
Convert the given text to html by adding <br>.
|
static java.lang.String |
breakTextAtWords(java.lang.String text,
java.lang.String insert,
int lineSize)
Break the given text into lines, respecting word boundaries (blank space).
|
static java.lang.String |
camelCase(java.lang.String s)
Camel case a string (eg howard -> Howard)
|
static java.lang.String |
collapseWhitespace(java.lang.String s)
Collapse continuous whitespace into one single " ".
|
static boolean |
containsRegExp(java.lang.String patternString)
See if a pattern string contains regular expression characters
(^,*,$,+).
|
static java.lang.String |
escape(java.lang.String x,
java.lang.String okChars)
Escape any char not alphanumeric or in okChars.
|
static java.util.List |
expandIso8601(java.lang.String time)
A first attempt at parsing a dttm range string
|
static java.lang.String |
findFormatString(java.lang.String macroName,
java.lang.String macroDelimiter,
java.lang.String text)
Return the format string in the given text for the given macro.
|
static java.lang.Object |
findMatch(java.lang.String source,
java.util.List patternList,
java.util.List results,
java.lang.Object dflt)
Run through the List of patterns (pattern, result) and return
corresponding result whose pattern matches the source string.
|
static java.lang.Object |
findMatch(java.lang.String source,
java.util.List patternList,
java.lang.Object dflt)
Run through the List of Objects and return the Object whose
toString matches the source string.
|
static java.lang.String |
findPattern(java.lang.String source,
java.lang.String patternString)
Find the pattern in a string
|
static java.lang.String |
getAnOrA(java.lang.String subject)
Get "a" or "an" for prefixing to a string based on the first
character
|
static java.lang.String |
ignoreescape(java.lang.String x,
java.lang.String okChars) |
static boolean |
isDigits(java.lang.String s)
Return true if all characters are numeric.
|
static boolean |
isLowerCase(java.lang.String s)
Is the string all lower case?
|
static boolean |
isUpperCase(java.lang.String s)
Is the string all upper case?
|
static java.lang.String |
join(java.lang.String[] args)
Merge the given strings, using a space between each.
|
static java.lang.String |
join(java.lang.String delimiter,
java.util.List args)
Merge the given strings, using the given delimiter between each.
|
static java.lang.String |
join(java.lang.String delimiter,
java.util.List args,
boolean ignoreEmptyStrings)
Merge the given strings, using the given delimiter between each.
|
static java.lang.String |
join(java.lang.String delimiter,
java.lang.Object[] args)
Merge the given strings, using the given delimiter between each.
|
static java.lang.String |
join(java.lang.String delimiter,
java.lang.Object[] args,
boolean ignoreEmptyStrings)
Merge the given strings, using the given delimiter between each.
|
static java.lang.String |
listToString(java.util.List l)
Take the List of objects and return a String of all the
list's elements toString values appended to each other,
separated by semicolons
|
static java.lang.String[] |
listToStringArray(java.util.List objectList)
Take the List of objects and return a String array
of the toString values of each object in the list.
|
static void |
main(java.lang.String[] args) |
static void |
main1(java.lang.String[] args)
Method for debugging.
|
static void |
main2(java.lang.String[] args)
test
|
static java.lang.String |
makeValidCdmObjectName(java.lang.String name) |
static int |
match(java.lang.String s1,
java.lang.String s2)
Count number of chars that match in two strings, starting from front.
|
static boolean |
notEmpty(java.lang.String s)
Check if the string is not empty
|
static java.lang.String |
padLeft(java.lang.String s,
int desiredLength)
Pad the given string with spaces on the left up to the given length.
|
static java.lang.String |
padLeft(java.lang.String s,
int desiredLength,
java.lang.String padString)
Pad the given string with padString on the left up to the given length.
|
static java.lang.String |
padRight(java.lang.String s,
int desiredLength)
Pad the given string with spaces on the right up to the given length.
|
static java.lang.String |
padRight(java.lang.String s,
int desiredLength,
java.lang.String padString)
Pad the given string with padString on the right up to the given length.
|
static java.lang.String |
padZero(int value,
int numDigits)
Left pad the given value with zeros up to the number of digits
|
static double[][] |
parseCoordinates(java.lang.String coords)
Parse the lat/lon/alt coordinate string
|
static java.util.List |
parseCsv(java.lang.String s,
boolean skipFirst)
Parse a comma separated value (CVS) String
|
static java.util.Date |
parseDate(java.lang.String dttm)
Parse the date.
|
static java.util.List |
parseFloatListString(java.lang.String s)
Parse the given string and return a list of flost values.
|
static java.util.Hashtable |
parseHtmlProperties(java.lang.String s)
Parse HTML Properties
|
static java.util.List |
parseIntegerListString(java.lang.String s)
Parse the given string and return a list of Integer values.
|
static java.util.Date |
parseIso8601(java.lang.String time)
Not working yet but this is supposed to parse an iso8601 date format
|
static java.util.List<java.lang.String[]> |
parseLineWords(java.lang.String content,
int[] indices,
int[] lengths,
java.lang.String lineDelimiter,
java.lang.String commentString,
boolean trimWords)
This splits the given content String into a set of lines
(delimited by the given lineDelimiter).
|
static java.util.List<java.lang.String[]> |
parseLineWords(java.lang.String content,
int[] lengths,
java.lang.String lineDelimiter,
java.lang.String commentString,
boolean trimWords)
This splits the given content String into a set of lines
(delimited by the given lineDelimiter).
|
static java.util.Hashtable |
parsePropertiesString(java.lang.String s)
Parse the semi-colon delimited string of name=value properties.
|
static long |
parseTimePeriod(java.lang.String s)
Note, right now this just parses the hour/minute/second periods
|
static java.lang.String |
quoteHtmlContent(java.lang.String x)
Replace special characters with entities for HTML content.
|
static java.lang.String |
quoteXmlAttribute(java.lang.String x)
Replace special characters with entities for XML attributes.
|
static java.lang.String |
quoteXmlContent(java.lang.String x)
Replace special characters with entities for XML attributes.
|
static boolean |
regexpMatch(java.lang.String input,
java.lang.String patternString)
Match a regular expression
|
static java.lang.String |
removeWhitespace(java.lang.String inputString)
Remove any whitespace (ie., Character.isWhitespace) from the input string.
|
static java.lang.String |
repeat(java.lang.String s,
int cnt)
Concatentate the given string cnt times
|
static void |
replace(java.lang.StringBuffer sb,
char out,
java.lang.String in)
Replace any char "out" in sb with "in".
|
static java.lang.String |
replace(java.lang.String x,
char[] replaceChar,
java.lang.String[] replaceWith)
Replace all occurences of replaceChar with replaceWith
|
static java.lang.String |
replace(java.lang.String s,
char out,
java.lang.String in)
Replace any char "out" in s with "in".
|
static java.lang.String |
replace(java.lang.String string,
java.lang.String pattern,
java.lang.String value)
Replaces all occurrences of "pattern" in "string" with "value"
|
static java.lang.String |
replaceDate(java.lang.String s,
java.lang.String macroName,
java.util.Date date)
Replace the macro within s with the formatted date.
|
static java.lang.String |
replaceDate(java.lang.String s,
java.lang.String macroName,
java.util.Date date,
java.lang.String macroPrefix,
java.lang.String macroSuffix)
Replace the macro within s with the formatted date.
|
static java.lang.String |
replaceDate(java.lang.String s,
java.lang.String macroName,
java.util.Date date,
java.lang.String macroPrefix,
java.lang.String macroSuffix,
java.util.TimeZone timeZone)
Replace the macro within s with the formatted date.
|
static java.lang.String |
replaceDate(java.lang.String s,
java.lang.String macroName,
java.util.Date date,
java.util.TimeZone timeZone)
Replace the macro within s with the formatted date.
|
static java.util.List |
replaceList(java.util.List sourceList,
java.lang.String[] patterns,
java.lang.String[] values)
Construct and return a list of Strings where each string is the result
of replacing all of the patterns with the corresponding values for
each String in the given sourceList .
|
static java.lang.String |
replaceList(java.lang.String v,
java.util.List patterns,
java.util.List values)
Replaces all occurrences of "patterns" in "v" with "values"
|
static java.lang.String |
replaceList(java.lang.String v,
java.lang.String[] patterns,
java.lang.String[] values)
Replaces all occurrences of "patterns" in "v" with "values"
|
static java.lang.String |
shorten(java.lang.String s,
int length)
Shorten a string using elipses (...)
|
static java.util.List<java.lang.String> |
split(java.lang.Object source)
Tokenize the toString value of the given source object,
splitting on ",".
|
static java.util.List<java.lang.String> |
split(java.lang.Object source,
java.lang.String delimiter)
Tokenize the toString value of the given source object,
splitting on the given delimiter.
|
static java.util.List<java.lang.String> |
split(java.lang.Object source,
java.lang.String delimiter,
boolean trim)
Tokenize the toString value of the given source object, splitting on
the given delimiter.
|
static java.util.List<java.lang.String> |
split(java.lang.Object source,
java.lang.String delimiter,
boolean trim,
boolean excludeZeroLength)
Tokenize the toString value of the given source object, splitting
on the given delimiter.
|
static java.lang.String[] |
split(java.lang.String s,
java.lang.String delimiter,
int cnt)
Split the given string into the first cnt number of substrings
as delimited by the given delimiter.
|
static java.util.List<java.lang.String> |
splitMacros(java.lang.String s)
This parses the given string with the following form.
|
static java.lang.String[] |
splitString(java.lang.String source)
Split a string on one or more whitespace.
|
static java.util.List<java.lang.String> |
splitUpTo(java.lang.String s,
java.lang.String delimiter,
int cnt)
Split up to a certain number of characters
|
static java.util.List<java.lang.String> |
splitWithQuotes(java.lang.String s)
tokenize the given string on spaces.
|
static boolean |
startsWithVowel(java.lang.String value)
Check to see if the string starts with a vowel.
|
static void |
string_Sort(java.lang.String[] my_arr,
int substart,
int subend)
sort a string array by comparing the sub string
|
static boolean |
stringMatch(java.lang.String input,
java.lang.String patternString)
Check if the given input String matches the given pattern String.
|
static boolean |
stringMatch(java.lang.String input,
java.lang.String patternString,
boolean substring,
boolean caseSensitive)
Check if the given input String matches the given pattern String.
|
static java.lang.String |
stripAndReplace(java.lang.String s,
java.lang.String pattern1,
java.lang.String pattern2,
java.lang.String replace)
Replaces all occurrences of the strings delimited by patter1/pattern2 with replace, e.g.: "pattern1 ...
|
static java.lang.String |
stripHtmlTag(java.lang.String html)
Remove any beginning or ending <html> tags
|
static java.lang.String |
stripTags(java.lang.String html)
Remove all text contained within "< >" tags.
|
static void |
substitute(java.lang.StringBuffer sbuff,
java.lang.String match,
java.lang.String subst)
Find all occurences of the "match" in original, and substitute the "subst" string,
directly into the original.
|
static java.lang.String |
substitute(java.lang.String original,
java.lang.String[] match,
java.lang.String[] subst)
Find all occurences of match strings in original, and substitute the corresponding
subst string.
|
static java.lang.String |
substitute(java.lang.String original,
java.lang.String match,
java.lang.String subst)
Find all occurences of the "match" in original, and substitute the "subst" string.
|
static java.lang.String |
toHexString(java.awt.Color c)
Convert the given color to is string hex representation
|
static java.util.List |
toString(java.util.List l)
Convert the list of objects to a list of strings.
|
static java.lang.String |
toString(java.lang.Object[] array)
Create a string representation of the given array
|
static java.lang.String |
unquoteXmlAttribute(java.lang.String x)
Reverse XML quoting to recover the original string.
|
static java.lang.String |
unquoteXmlContent(java.lang.String x)
Reverse XML quoting to recover the original string.
|
static void |
unreplace(java.lang.StringBuffer sb,
java.lang.String out,
char in)
Replace any String "out" in sb with char "in".
|
static java.lang.String |
unreplace(java.lang.String x,
java.lang.String[] orgReplace,
char[] orgChar)
Replace all occurences of orgReplace with orgChar; inverse of replace().
|
static java.lang.String |
wildcardToRegexp(java.lang.String wildcard)
Change a wildcard expression to a proper regular expression
|
static java.lang.String |
zeroString(int value)
If the given value is less than 10 than pad the String return
with a leading "0".
|
public static boolean debug
public static final java.lang.String[] ordinalNames
public static boolean notEmpty(java.lang.String s)
s
- String to checkpublic static java.lang.String collapseWhitespace(java.lang.String s)
s
- operate on this stringpublic static java.lang.String findFormatString(java.lang.String macroName, java.lang.String macroDelimiter, java.lang.String text)
macroName
- The name of the macromacroDelimiter
- The delimiter used. e.g. '%'text
- the textpublic static java.lang.String substitute(java.lang.String original, java.lang.String match, java.lang.String subst)
original
- starting stringmatch
- string to matchsubst
- string to substitutepublic static java.lang.String repeat(java.lang.String s, int cnt)
s
- base stringcnt
- public static java.lang.String substitute(java.lang.String original, java.lang.String[] match, java.lang.String[] subst)
original
- starting stringmatch
- array of strings to matchsubst
- array of strings to substitutepublic static void substitute(java.lang.StringBuffer sbuff, java.lang.String match, java.lang.String subst)
sbuff
- starting string buffermatch
- string to matchsubst
- string to substitutepublic static boolean isDigits(java.lang.String s)
s
- operate on this Stringpublic static java.lang.String quoteHtmlContent(java.lang.String x)
x
- string to quotepublic static java.lang.String quoteXmlContent(java.lang.String x)
x
- string to quotepublic static java.lang.String unquoteXmlContent(java.lang.String x)
x
- string to quotepublic static java.lang.String quoteXmlAttribute(java.lang.String x)
x
- string to quotepublic static java.lang.String unquoteXmlAttribute(java.lang.String x)
x
- string to quotepublic static java.lang.String makeValidCdmObjectName(java.lang.String name)
public static java.lang.String replace(java.lang.String x, char[] replaceChar, java.lang.String[] replaceWith)
x
- operate on this stringreplaceChar
- get rid of thesereplaceWith
- replace with thesepublic static java.lang.String unreplace(java.lang.String x, java.lang.String[] orgReplace, char[] orgChar)
x
- operate on this stringorgReplace
- get rid of theseorgChar
- replace with thesepublic static int match(java.lang.String s1, java.lang.String s2)
s1
- compare this strings2
- compare this stringpublic static void replace(java.lang.StringBuffer sb, char out, java.lang.String in)
sb
- StringBuffer to replaceout
- repalce this characterin
- with this stringpublic static void unreplace(java.lang.StringBuffer sb, java.lang.String out, char in)
sb
- StringBuffer to replaceout
- repalce this Stringin
- with this charpublic static java.lang.String replace(java.lang.String s, char out, java.lang.String in)
s
- string to replaceout
- repalce this characterin
- with this stringpublic static java.lang.String escape(java.lang.String x, java.lang.String okChars)
x
- escape this stringokChars
- these are ok.public static java.lang.String ignoreescape(java.lang.String x, java.lang.String okChars)
public static java.lang.String toHexString(java.awt.Color c)
c
- colorpublic static java.lang.Object findMatch(java.lang.String source, java.util.List patternList, java.lang.Object dflt)
source
- Source String to match on.patternList
- List of objects whose toString is the pattern.dflt
- The default if nothing matches.public static java.lang.Object findMatch(java.lang.String source, java.util.List patternList, java.util.List results, java.lang.Object dflt)
source
- Source String to match on.patternList
- List of objects whose toString is the pattern.results
- The list of return objects.dflt
- The default if nothing matches.public static boolean containsRegExp(java.lang.String patternString)
patternString
- pattern string to checkpublic static boolean stringMatch(java.lang.String input, java.lang.String patternString)
input
- The input source string.patternString
- The regular expression pattern.public static boolean stringMatch(java.lang.String input, java.lang.String patternString, boolean substring, boolean caseSensitive)
input
- The input source string.patternString
- The regular expression pattern.substring
- Search for substringscaseSensitive
- Is case sensitivepublic static boolean regexpMatch(java.lang.String input, java.lang.String patternString)
input
- string to matchpatternString
- reg ex pattern stringpublic static java.lang.String wildcardToRegexp(java.lang.String wildcard)
wildcard
- wildcard string (*, ?);public static boolean startsWithVowel(java.lang.String value)
value
- String to checkpublic static java.lang.String breakText(java.lang.String text, java.lang.String insert, int lineSize)
text
- The text to convertinsert
- string to insertlineSize
- line size to insert atpublic static java.lang.String breakTextAtWords(java.lang.String text, java.lang.String insert, int lineSize)
text
- The text to convertinsert
- break to insertlineSize
- line size to insert atpublic static java.lang.String stripHtmlTag(java.lang.String html)
html
- the htmlpublic static java.lang.String stripTags(java.lang.String html)
html
- The source html string.public static java.lang.String stripAndReplace(java.lang.String s, java.lang.String pattern1, java.lang.String pattern2, java.lang.String replace)
s
- initial stringpattern1
- delimiter 1pattern2
- delimiter 2replace
- replace withpublic static java.lang.String removeWhitespace(java.lang.String inputString)
inputString
- The string to remove the whitespace.public static java.lang.String zeroString(int value)
value
- The value.public static java.lang.String padZero(int value, int numDigits)
value
- The value.numDigits
- number of digitspublic static java.lang.String padLeft(java.lang.String s, int desiredLength)
s
- String to paddesiredLength
- ending lengthpublic static java.lang.String padLeft(java.lang.String s, int desiredLength, java.lang.String padString)
s
- String to paddesiredLength
- ending lengthpadString
- String to pad with (e.g, " ")public static java.lang.String padRight(java.lang.String s, int desiredLength)
s
- String to paddesiredLength
- ending lengthpublic static java.lang.String padRight(java.lang.String s, int desiredLength, java.lang.String padString)
s
- String to paddesiredLength
- ending lengthpadString
- String to pad with (e.g, " ")public static java.lang.String join(java.lang.String[] args)
args
- An array of Strings to merge.public static java.lang.String join(java.lang.String delimiter, java.lang.Object[] args)
delimiter
- The delimiter.args
- An array of Strings to merge.public static java.lang.String join(java.lang.String delimiter, java.lang.Object[] args, boolean ignoreEmptyStrings)
delimiter
- The delimiter.args
- An array of Strings to merge.ignoreEmptyStrings
- Don't join empty stringspublic static java.lang.String join(java.lang.String delimiter, java.util.List args)
delimiter
- The delimiter.args
- A List of objects whose toString value are merged.public static java.lang.String join(java.lang.String delimiter, java.util.List args, boolean ignoreEmptyStrings)
delimiter
- The delimiter.args
- A List of objects whose toString value are merged.ignoreEmptyStrings
- Should ignore empty stringspublic static java.util.List<java.lang.String> split(java.lang.Object source)
source
- The source object string.public static java.util.Date parseDate(java.lang.String dttm)
yyyy-MM-dd HH:mm:ss z yyyy-MM-dd HH:mm:ss yyyy-MM-dd HH:mm yyyy-MM-dd yyyyMMddHHmmss yyyyMMddHHmm yyyyMMddHH yyyyMMdd
dttm
- The date stringpublic static java.util.List parseIntegerListString(java.lang.String s)
1,2,3 - the numbers 1 2 and 3 0:10,15:20,30 - 0-10, 15-20 and 30 0:10:2 - 0,2,4,6,8,10
s
- The string to parsepublic static java.util.List parseFloatListString(java.lang.String s)
1.0,2.0,3.0 - the numbers 1.0 2.0 and 3.0
s
- The string to parsepublic static java.util.List<java.lang.String[]> parseLineWords(java.lang.String content, int[] lengths, java.lang.String lineDelimiter, java.lang.String commentString, boolean trimWords)
content
- The String to parselengths
- the length of each word.lineDelimiter
- What to split the line content string on
(usually "\n").commentString
- If non-null defines the comment String in
the content.trimWords
- Do we trim each word.public static java.util.List<java.lang.String[]> parseLineWords(java.lang.String content, int[] indices, int[] lengths, java.lang.String lineDelimiter, java.lang.String commentString, boolean trimWords)
content
- The String to parseindices
- the index in the line which defines the word start.lengths
- the length of each word.lineDelimiter
- What to split the line content string on (usually "\n").commentString
- If non-null defines the comment String in the content.trimWords
- Do we trim each word.public static java.lang.String[] splitString(java.lang.String source)
source
- split this stringpublic static java.util.List<java.lang.String> split(java.lang.Object source, java.lang.String delimiter)
source
- The source object string.delimiter
- The delimiter to break up the sourceString on.public static java.util.List<java.lang.String> split(java.lang.Object source, java.lang.String delimiter, boolean trim)
source
- The source object string.delimiter
- The delimiter to break up the sourceString on.trim
- Do we string trim the tokens.public static java.util.List<java.lang.String> splitWithQuotes(java.lang.String s)
s
- The string to tokenizepublic static java.util.List<java.lang.String> split(java.lang.Object source, java.lang.String delimiter, boolean trim, boolean excludeZeroLength)
source
- The source object string.delimiter
- The delimiter to break up the sourceString on.trim
- Do we string trim the tokens.excludeZeroLength
- If true then don't add in zero length strings.public static java.lang.String[] split(java.lang.String s, java.lang.String delimiter, int cnt)
s
- String to splitdelimiter
- token delimetercnt
- max number of tokensnull
if unable to split
the string.public static java.util.List<java.lang.String> splitUpTo(java.lang.String s, java.lang.String delimiter, int cnt)
s
- the string to splitdelimiter
- the delimitercnt
- the max numberpublic static java.lang.String replaceDate(java.lang.String s, java.lang.String macroName, java.util.Date date)
s
- source stringmacroName
- macro name_date
- date to usepublic static java.lang.String replaceDate(java.lang.String s, java.lang.String macroName, java.util.Date date, java.util.TimeZone timeZone)
s
- source stringmacroName
- macro name_date
- date to usetimeZone
- timezone for formatpublic static java.lang.String replaceDate(java.lang.String s, java.lang.String macroName, java.util.Date date, java.lang.String macroPrefix, java.lang.String macroSuffix)
s
- source stringmacroName
- macro name_date
- date to usemacroPrefix
- the macro prefixmacroSuffix
- the macro suffixpublic static java.lang.String replaceDate(java.lang.String s, java.lang.String macroName, java.util.Date date, java.lang.String macroPrefix, java.lang.String macroSuffix, java.util.TimeZone timeZone)
s
- source stringmacroName
- macro namedate
- date to usemacroPrefix
- the macro prefixmacroSuffix
- the macro suffixtimeZone
- for the datespublic static java.lang.String[] listToStringArray(java.util.List objectList)
objectList
- The list of objects.public static java.lang.String listToString(java.util.List l)
l
- list of objectspublic static java.util.List toString(java.util.List l)
l
- List of objectspublic static java.lang.String replace(java.lang.String string, java.lang.String pattern, java.lang.String value)
string
- string to mungepattern
- pattern to replacevalue
- replacement valuepublic static java.lang.String replaceList(java.lang.String v, java.lang.String[] patterns, java.lang.String[] values)
v
- original Stringpatterns
- patterns to matchvalues
- replacement valuespublic static java.lang.String replaceList(java.lang.String v, java.util.List patterns, java.util.List values)
v
- original Stringpatterns
- patterns to matchvalues
- replacement valuespublic static java.util.List replaceList(java.util.List sourceList, java.lang.String[] patterns, java.lang.String[] values)
sourceList
- original list of Stringspatterns
- patterns to replacevalues
- replacement valuespublic static java.lang.StringBuffer append(java.lang.StringBuffer sb, java.lang.Object s1)
sb
- StringBuffer to append to (may be null
)s1
- object to appendpublic static java.lang.StringBuffer append(java.lang.StringBuffer sb, java.lang.Object s1, java.lang.Object s2)
sb
- StringBuffer to append to (may be null
)s1
- first object to appends2
- second object to appendpublic static java.lang.StringBuffer append(java.lang.StringBuffer sb, java.lang.Object s1, java.lang.Object s2, java.lang.Object s3)
sb
- StringBuffer to append to (may be null
)s1
- first object to appends2
- second object to appends3
- third object to appendpublic static java.lang.StringBuffer append(java.lang.StringBuffer sb, java.lang.Object s1, java.lang.Object s2, java.lang.Object s3, java.lang.Object s4)
sb
- StringBuffer to append to (may be null
)s1
- first object to appends2
- second object to appends3
- third object to appends4
- fourth object to appendpublic static java.lang.StringBuffer append(java.lang.StringBuffer sb, java.lang.Object s1, java.lang.Object s2, java.lang.Object s3, java.lang.Object s4, java.lang.Object s5)
sb
- StringBuffer to append to (may be null
)s1
- first object to appends2
- second object to appends3
- third object to appends4
- fourth object to appends5
- fifth object to appendpublic static java.util.List parseCsv(java.lang.String s, boolean skipFirst)
s
- String to parseskipFirst
- true to skip the first valuepublic static final java.lang.String shorten(java.lang.String s, int length)
s
- String to shortenlength
- shortened length where elipses will startpublic static java.lang.String toString(java.lang.Object[] array)
array
- array to printpublic static java.util.List expandIso8601(java.lang.String time)
time
- The timepublic static java.lang.String findPattern(java.lang.String source, java.lang.String patternString)
source
- String to searchpatternString
- patternpublic static boolean isUpperCase(java.lang.String s)
s
- string to checkpublic static boolean isLowerCase(java.lang.String s)
s
- string to checkpublic static java.lang.String camelCase(java.lang.String s)
s
- string to camel casepublic static java.util.Date parseIso8601(java.lang.String time)
time
- datepublic static long parseTimePeriod(java.lang.String s)
s
- The date stringpublic static java.util.Hashtable parsePropertiesString(java.lang.String s)
s
- Semi-colon delimited name=value stringpublic static java.util.Hashtable parseHtmlProperties(java.lang.String s)
s
- the stringpublic static void main(java.lang.String[] args)
public static void main2(java.lang.String[] args)
args
- argspublic static void main1(java.lang.String[] args) throws java.lang.Exception
args
- argumentsjava.lang.Exception
- some problempublic static java.util.List<java.lang.String> splitMacros(java.lang.String s)
some text ${macro1} more text ... ${macro2} ... ${macroN} end textIt returns a list that flip-flops between the text and the macro:
[some text, macro1, more text, ..., macro2, ..., macroN, end text]
s
- String to parsepublic static java.lang.String applyMacros(java.lang.String s, java.util.Hashtable props, boolean throwError)
some text ${macro1} more text ... ${macro2} ... ${macroN} end textAnd replaces the macros with values from the given properties table If throwError is true then an IllegalArgumentException is thrown if the properties does not contain one of the macros
s
- String to processprops
- Contains the macro valuesthrowError
- Throw exception when macro is missingpublic static double[][] parseCoordinates(java.lang.String coords)
coords
- comma and space separated coord stringpublic static java.lang.String getAnOrA(java.lang.String subject)
subject
- subject to prefixpublic static void string_Sort(java.lang.String[] my_arr, int substart, int subend)
substart
- sub string start indexsubend
- sub string end index