|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.safs.StringUtils
public class StringUtils
Purpose: string utilities
| Field Summary | |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
|
static int |
maxBytesPerRead
|
static java.lang.String |
REGEX_CHARACTER_ANY
|
static java.lang.String |
REGEX_CHARACTER_MATCH_MANY
|
static java.lang.String |
REGEX_CHARACTER_MATCH_ONE
|
static java.lang.String[] |
specialKeys
|
| Constructor Summary | |
|---|---|
StringUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
arrayToString(java.lang.String[] values,
java.lang.String sep)
|
static java.lang.String |
concat(java.lang.String s1,
java.lang.String s2,
java.lang.String s3)
Purpose: concatenate strings |
static boolean |
containsSepcialKeys(java.lang.String value)
|
static java.lang.String |
convertWildcardsToRegularExpression(java.lang.String input)
convert ? and * wildcarding to regular expression wildcarding .? and .* |
static int |
findExactMatchIndex(java.util.ListIterator iter,
java.lang.String match)
Purpose: find an exact match based on the parameter by walking the list, finding a string which equals the matching string, and returning the index into the list if it matched. |
static int |
findMatchIndex(java.util.ListIterator iter,
java.lang.String match)
Purpose: find a match based on the parameter by walking the list, finding a string which contains the matching substring, and returning the index into the list if it matched. |
static java.lang.String |
getChars(java.lang.Integer num,
java.lang.String chars)
Purpose: get a string with the number of specified sequenced 'chars' |
static java.lang.String |
getDBVal(java.lang.Object m)
Deprecated. for DatabaseUtils.getDBVal(Object) |
static java.lang.String |
getDelimitedString(java.util.List<java.lang.String> list,
java.lang.String delimiter)
Purpose: Get text strung delimited by delimiter from a list, delimiter will be considered as a whole string Example: If delimiter is "->", if the list contains 3 items, "parent" "child" "grandChild" the returned text is "parent->child->grandChild" |
static int |
getFieldCount(java.lang.String input,
int startindex,
java.lang.String seps)
Purpose: Finds the count of all fields within the inputRecord found from startindex to the end of the inputRecord. |
static java.lang.String |
getInputToken(java.lang.String input,
int n,
java.lang.String sep)
Purpose: get 0-based field N of input by tokenizing with sep. |
static java.lang.String[] |
getSortArray(java.lang.String[] inp)
|
static java.lang.String |
getSpaces(java.lang.Integer num)
Purpose: get a string with the number of specified spaces |
static java.util.List |
getTokenList(java.lang.String text,
java.lang.String delimiter)
Purpose: Get tokens of text delimited by delimiter, delimiter will be considered as a whole string Example: If delimiter is "->", text is "parent->child->grandChild", then the returned list will contains 3 items, "parent" "child" "grandChild". |
static java.lang.String |
getTrimmedUnquotedStr(java.lang.String str)
Purpose: This method takes a string trims it of leading and trailing spaces, non-breaking spaces, and tabs, and then strips one leading and/or trailing quotation mark(#34)--if they exist. |
static boolean |
isCaseContainsMatch(java.lang.String source,
java.lang.String target,
boolean exactMatch)
Purpose: evaluate 2 string values to see if they match. |
static java.lang.String |
leftTrimSpace(java.lang.String text)
Trims all chars below char (int) 32 EXCEPT for TAB char (int) 9 from the left side of the provided text string. |
static boolean |
matchRegex(java.lang.String expression,
java.lang.String value)
Purpose: match a regular expression to a value. |
static java.lang.StringBuffer |
readBinaryFile(java.lang.String filename)
Purpose: read Binary file based on 'filename', returns String |
static java.util.Collection |
readEncodingfile(java.lang.String filename,
java.lang.String encoding)
read file based on 'filename', returns collection of lines with no CR or LF. |
static java.util.Collection |
readfile(java.lang.String filename)
read file based on 'filename', returns collection of lines with no CR or LF. |
static java.util.Collection |
readstring(java.lang.String str)
read string, returns collection of lines with no CR or LF. |
static java.util.Collection |
readUTF8file(java.lang.String filename)
read file based on 'filename', returns collection of lines with no CR or LF. |
static java.lang.String |
rightTrimSpace(java.lang.String text)
Trims all chars below char (int) 32 EXCEPT for TAB characters (int) 9 from the right side of the provided text string. |
static void |
writeEncodingfile(java.lang.String filename,
java.util.Collection list,
java.lang.String encoding)
Note: The file will be opened as OutputStreamWriter with encoding write to file 'filename' the toString() values contained in list. |
static void |
writefile(java.lang.String filename,
java.util.Collection list)
write to file 'filename' the toString() values contained in list. |
static void |
writefile(java.lang.String filename,
java.util.Collection list,
java.lang.String delim)
Deprecated. for DatabaseUtils.writefile(String, Collection, String) |
static void |
writeUTF8file(java.lang.String filename,
java.util.Collection list)
Note: The file will be opened as UTF-8 OutputStreamWriter write to file 'filename' the toString() values contained in list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String REGEX_CHARACTER_ANY
public static final java.lang.String REGEX_CHARACTER_MATCH_MANY
public static final java.lang.String REGEX_CHARACTER_MATCH_ONE
public static final int maxBytesPerRead
public static final int DEFAULT_BUFFER_SIZE
public static final java.lang.String[] specialKeys
| Constructor Detail |
|---|
public StringUtils()
| Method Detail |
|---|
public static int findMatchIndex(java.util.ListIterator iter,
java.lang.String match)
iter, - ListIteratormatch, - String
public static int findExactMatchIndex(java.util.ListIterator iter,
java.lang.String match)
iter, - ListIteratormatch, - String
public static boolean isCaseContainsMatch(java.lang.String source,
java.lang.String target,
boolean exactMatch)
source, - String to match against target. Can be a case-insensitive
substring of target if exactMatch is false.
target, - String to compare with source.
exactMatch, - false allows a case-insensitive comparison for a source
substring in target. Otherwise, the source and target must match exactly.
public static java.lang.String getSpaces(java.lang.Integer num)
num - Integer
public static java.lang.String getChars(java.lang.Integer num,
java.lang.String chars)
num - Integerchars - String
public static java.util.Collection readfile(java.lang.String filename)
throws java.io.IOException
filename, - String
java.io.IOExceptionFileUtilities.getSystemBufferedFileReader(String),
readBuffer(BufferedReader)
public static java.util.Collection readUTF8file(java.lang.String filename)
throws java.io.IOException
filename, - String
java.io.IOExceptionFileUtilities.getUTF8BufferedFileReader(String),
readBuffer(BufferedReader)
public static java.util.Collection readEncodingfile(java.lang.String filename,
java.lang.String encoding)
throws java.io.IOException
filename, - Stringencoding, - the character encoding used to read a file.
java.io.IOExceptionFileUtilities.getUTF8BufferedFileReader(String),
readBuffer(BufferedReader)
public static java.util.Collection readstring(java.lang.String str)
throws java.io.IOException
str, - String,
java.io.IOExceptionStringReader,
BufferedReader.readLine()
public static java.lang.StringBuffer readBinaryFile(java.lang.String filename)
throws java.io.IOException
filename, - String
java.io.IOException
public static void writefile(java.lang.String filename,
java.util.Collection list)
throws java.io.IOException
filename - String full absolute path filename of file to write.list - Collection of lines to write.
java.io.FileNotFoundException - if file cannot be created for any reason.
java.io.IOException - if an error occurs during write operations.FileUtilities.getSystemBufferedFileWriter(String),
FileUtilities.writeCollectionToFile(BufferedWriter, Collection, String)
public static void writeUTF8file(java.lang.String filename,
java.util.Collection list)
throws java.io.IOException
filename - String full absolute path filename of file to write.list - Collection of lines to write.
java.io.FileNotFoundException - if file cannot be created for any reason.
java.io.IOException - if an error occurs during write operations.FileUtilities.getSystemBufferedFileWriter(String),
FileUtilities.writeCollectionToFile(BufferedWriter, Collection, String)
public static void writeEncodingfile(java.lang.String filename,
java.util.Collection list,
java.lang.String encoding)
throws java.io.IOException
filename - String full absolute path filename of file to write.list - Collection of lines to write.encoding - Encoding is used to write a file.
java.io.FileNotFoundException - if file cannot be created for any reason.
java.io.IOException - if an error occurs during write operations.FileUtilities.getSystemBufferedFileWriter(String),
FileUtilities.writeCollectionToFile(BufferedWriter, Collection, String)
public static void writefile(java.lang.String filename,
java.util.Collection list,
java.lang.String delim)
throws java.io.IOException
java.io.IOExceptionDatabaseUtils.writefile(String, Collection, String)public static java.lang.String getDBVal(java.lang.Object m)
DatabaseUtils.getDBVal(Object)public static java.lang.String leftTrimSpace(java.lang.String text)
public static java.lang.String rightTrimSpace(java.lang.String text)
public static java.lang.String getTrimmedUnquotedStr(java.lang.String str)
str, - String to unquote
public static java.lang.String concat(java.lang.String s1,
java.lang.String s2,
java.lang.String s3)
s1, - Strings2, - Strings3, - String
public static java.lang.String convertWildcardsToRegularExpression(java.lang.String input)
public static boolean matchRegex(java.lang.String expression,
java.lang.String value)
throws SAFSException
expression, - Stringvalue, - String
SAFSRegExException - if an error occurs.
SAFSRegExNotFoundException - if no RegEx support class can be found.
SAFSExceptionpublic static java.lang.String[] getSortArray(java.lang.String[] inp)
public static java.lang.String getInputToken(java.lang.String input,
int n,
java.lang.String sep)
throws SAFSNullPointerException
input, - Stringn, - int 0-based indexsep, - String
SAFSNullPointerException - if input or sep are null
java.lang.StringIndexOutOfBoundsException - if not found for index n
public static int getFieldCount(java.lang.String input,
int startindex,
java.lang.String seps)
throws SAFSNullPointerException
input, - Stringstartindex, - intseps, - String
SAFSNullPointerException - if input or sep are null
public static java.util.List getTokenList(java.lang.String text,
java.lang.String delimiter)
text - delimiter -
public static java.lang.String getDelimitedString(java.util.List<java.lang.String> list,
java.lang.String delimiter)
list - delimiter -
public static boolean containsSepcialKeys(java.lang.String value)
public static java.lang.String arrayToString(java.lang.String[] values,
java.lang.String sep)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||