|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.safs.tools.stringutils.StringUtilities
public abstract class StringUtilities
| Field Summary | |
|---|---|
static java.lang.String |
DATE_FORMAT_a
|
static java.lang.String |
DATE_FORMAT_AM_PM_DATE_TIME
|
static java.lang.String |
DATE_FORMAT_AM_PM_TIME
|
static java.lang.String |
DATE_FORMAT_DATE
|
static java.lang.String |
DATE_FORMAT_MILITARY_DATE_TIME
|
static java.lang.String |
DATE_FORMAT_MILITARY_TIME
|
static java.lang.String |
FILE_TIME_BASE
|
static java.lang.String |
JAVA_TIME_BASE
|
static java.lang.String |
TIME_OF_AM
|
static java.lang.String |
TIME_OF_PM
|
static long |
TimeBaseDifferenceFromFileTimeToJavaTimeInMillisecond
TimeBaseDifferenceFromFileTimeToJavaTimeInMillisecond contains the difference from filetime to javatime in millisecond, it is initialized in the static code of this class. |
| Constructor Summary | |
|---|---|
StringUtilities()
|
|
| Method Summary | |
|---|---|
static boolean |
charIsInRange(char c,
int beg,
int end)
Method charIsInRange. |
static boolean |
convertBool(java.lang.String bool)
Returns a boolean value based on value of bool. |
static java.lang.Integer |
convertToInteger(java.lang.String value)
|
static java.lang.String |
findAndReplace(java.lang.String input,
java.lang.String search,
java.lang.String replace)
Replace all instances of search string with the replace string. |
static java.awt.Rectangle |
formRectangle(java.lang.String rectangleString,
java.lang.String separator)
|
static java.util.Date |
getDate(java.lang.String date,
java.lang.String dateFormat)
Note According to the dateFormat, use the SimpleDateFormat to convert a string to java.util.Date |
static java.lang.String |
getDateString(java.util.Date date)
Note With dateFormat "MM-dd-yyyy", use the SimpleDateFormat to convert the date object to string |
static java.lang.String |
getDateString(java.util.Date date,
java.lang.String dateFormat)
Note According to the dateFormat, use the SimpleDateFormat to convert the date object to string |
static java.lang.String |
getDateTimeString(java.util.Date date,
boolean isMilitary)
Note Use the SimpleDateFormat to convert the date object to string, keep both the date and the time part |
static int |
getNumSubstrings(java.lang.String strSub,
java.lang.String strText)
Method getNumSubstrings. |
static java.util.Vector |
getSubStrings(java.lang.String strText)
Method getSubStrings. |
static java.util.Vector |
getSubStrings(java.lang.String strText,
java.util.Vector vQuoteLocs)
Method getSubStrings. |
static java.lang.String |
getTimeString(java.util.Date date,
boolean isMilitary)
Note Use the SimpleDateFormat to convert the date object to string, just keep the time part |
static boolean |
isLegalVarName(java.lang.String strVarName)
Method isLegalVarName. |
static boolean |
isQuoted(java.lang.String strText,
int location)
Method isQuoted. |
static boolean |
isQuoted(java.lang.String strText,
int location,
java.util.Vector vQuoteLocs)
Method isQuoted. |
static boolean |
isValidNonStdChar(char c)
Method isValidNonStdChar. |
static int |
locateNextNonWhiteSpace(java.lang.String strSearch,
int ipos)
Method locateNextNonWhiteSpace. |
static int |
locateNextSubstring(java.lang.String strSearch,
java.lang.String strFind,
int ipos)
Method locateNextSubstring. |
static int |
locateNextUnquotedNonWhiteSpace(java.lang.String strSearch,
int ipos)
Method locateNextUnquotedNonWhiteSpace. |
static int |
locateNextUnquotedSingleChar(java.lang.String strSearch,
java.lang.String strChars,
int ipos)
Method locateNextUnquotedSingleChar. |
static int |
locateNextUnquotedSingleChar(java.lang.String strSearch,
java.lang.String strChars,
int ipos,
java.util.Vector vQuoteLocs)
Method locateNextUnquotedSingleChar. |
static int |
locateNextUnquotedSubstring(java.lang.String strSearch,
java.lang.String strFind,
int ipos)
Method locateNextUnquotedSubstring. |
static int |
locateNextUnquotedSubstring(java.lang.String strSearch,
java.lang.String strFind,
int ipos,
java.util.Vector vQuoteLocs)
Method locateNextUnquotedSubstring. |
static java.util.Vector |
locateQuotedSubStrings(java.lang.String strText)
Method locateQuotedSubStrings. |
static java.lang.String |
LTWhitespace(java.lang.String strValue)
Method LTWhitespace. |
static void |
main(java.lang.String[] args)
|
static boolean |
nextCharIsDQ(java.lang.String strText,
int location)
Method nextCharIsDQ. |
static java.lang.String |
removeAllNonQuotedWhitespace(java.lang.String strValue)
Method removeAllNonQuotedWhitespace. |
static java.lang.String |
removeAllNonQuotedWhitespace(java.lang.String strValue,
java.util.Vector vQuoteLocs)
Method removeAllNonQuotedWhitespace. |
static java.lang.String |
removeDoubleQuotes(java.lang.String original)
Remove any leading and\or trailing double quotes. |
static java.lang.String |
removePrefix(java.lang.String original,
java.lang.String prefix)
Remove the prefix from the original string, and return the result |
static java.lang.String |
removeRelativeFilePathPrefix(java.lang.String relativepath)
Attempts to remove ".\", "./", "\", or "/" relative path prefixes from the provided String. |
static java.lang.String |
removeSuffix(java.lang.String original,
java.lang.String suffix)
Remove the suffix from the original string, and return the result |
static java.lang.String |
replaceString(java.lang.String strSearch,
java.lang.String strReplace,
int ibegin,
int iend)
Method replaceString. |
static java.lang.String |
reverse(java.lang.String s)
Method reverse. |
static java.lang.String |
RTWhitespace(java.lang.String strValue)
Method RTWhitespace. |
static java.lang.String |
spacePad(int ipad)
Method spacePad. |
static java.lang.String |
TWhitespace(java.lang.String strValue)
Method TWhitespace. |
| 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 DATE_FORMAT_DATE
public static final java.lang.String DATE_FORMAT_MILITARY_TIME
public static final java.lang.String DATE_FORMAT_MILITARY_DATE_TIME
public static final java.lang.String DATE_FORMAT_AM_PM_TIME
public static final java.lang.String DATE_FORMAT_AM_PM_DATE_TIME
public static final java.lang.String DATE_FORMAT_a
public static final java.lang.String TIME_OF_AM
public static final java.lang.String TIME_OF_PM
public static final java.lang.String JAVA_TIME_BASE
public static final java.lang.String FILE_TIME_BASE
public static long TimeBaseDifferenceFromFileTimeToJavaTimeInMillisecond
TimeBaseDifferenceFromFileTimeToJavaTimeInMillisecond contains the difference from filetime to javatime in millisecond, it is initialized in the static code of this class. FileTime is a class defined in org.safs.natives.win32.Kernel32 FileTime contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC/GMT). FileTime's unit: 100 nanosecond FileTime's base: January 1, 1601 00:00:00 (UTC/GMT) JavaTime represents a point in time that is time milliseconds after January 1, 1970 00:00:00 (UTC/GMT). JavaTime's unit: millisecond JavaTime's base: January 1, 1970 00:00:00 (UTC/GMT) 1, 000, 000 nanoseconds = 1 millisecond As the unit and the base-time are different for FileTime and JavaTime, a conversion is needed. How to convert? Convert from FileTime to JavaTime: javatime = filetime/10000 - TimeBaseDifferenceFromFileTimeToJavaTimeInMillisecond Convert from JavaTime to FileTime: filetime = (javatime+TimeBaseDifferenceFromFileTimeToJavaTimeInMillisecond)*10000
Kernel32.FileTime,
NativeWrapper.convertFileTimeToJavaTime(org.safs.natives.win32.Kernel32.FileTime),
JAVA_TIME_BASE,
FILE_TIME_BASE,
DATE_FORMAT_MILITARY_DATE_TIME| Constructor Detail |
|---|
public StringUtilities()
| Method Detail |
|---|
public static java.lang.String LTWhitespace(java.lang.String strValue)
strValue - String to remove leading whitespace (space and tab)
public static java.lang.String RTWhitespace(java.lang.String strValue)
strValue - String to remove trailing whitespace (space and tab)
public static java.lang.String TWhitespace(java.lang.String strValue)
strValue - String to remove whitespace (space and tab)
public static boolean charIsInRange(char c,
int beg,
int end)
c - character to checkbeg - lower end of rangeend - higher end of range
public static int getNumSubstrings(java.lang.String strSub,
java.lang.String strText)
strSub - substring to count occurancesstrText - string to search for strSub occurances
public static boolean nextCharIsDQ(java.lang.String strText,
int location)
strText - String to checklocation - int location to start check
public static java.util.Vector locateQuotedSubStrings(java.lang.String strText)
Vector that contains
Integer objects whose intValue specifies the location of a double
quote (") in strText. Note that double quotes must be paired so there
should be an even number of Integer objects withing the returned Vector.
strText - String in which to locate the quoted substrings
public static boolean isQuoted(java.lang.String strText,
int location)
strText - String to checklocation - Location to check
public static boolean isQuoted(java.lang.String strText,
int location,
java.util.Vector vQuoteLocs)
strText - String to checklocation - Location to checkvQuoteLocs - Vector containing Integer objects whose intValue
specifies the location of a double quote (") in strText.
public static java.util.Vector getSubStrings(java.lang.String strText)
Vector containing String objects
that are quoted substrings within strText
strText - The string to find substrings
public static java.util.Vector getSubStrings(java.lang.String strText,
java.util.Vector vQuoteLocs)
Vector containing String objects
that are quoted substrings within strText
strText - The string to find substringsvQuoteLocs - Vector containing Integer objects whose intValue
specifies the location of a double quote (") in strText.
public static int locateNextUnquotedNonWhiteSpace(java.lang.String strSearch,
int ipos)
strSearch - ipos -
public static int locateNextNonWhiteSpace(java.lang.String strSearch,
int ipos)
strSearch - ipos -
public static int locateNextUnquotedSingleChar(java.lang.String strSearch,
java.lang.String strChars,
int ipos)
strSearch - The string to searchstrChars - A string consisting of single characters to find the first occurance ofipos - int position within strSearch to begin search
public static int locateNextUnquotedSingleChar(java.lang.String strSearch,
java.lang.String strChars,
int ipos,
java.util.Vector vQuoteLocs)
strSearch - The string to searchstrChars - A string consisting of single characters to find the first occurance ofipos - int position within strSearch to begin searchvQuoteLocs - Vector containing Integer objects whose intValue
specifies the location of a double quote (") in strText.
public static int locateNextUnquotedSubstring(java.lang.String strSearch,
java.lang.String strFind,
int ipos)
strSearch - The string to searchstrFind - The substring to search foripos - int position within strSearch to begin search
public static int locateNextUnquotedSubstring(java.lang.String strSearch,
java.lang.String strFind,
int ipos,
java.util.Vector vQuoteLocs)
strSearch - The string to searchstrFind - The substring to search foripos - int position within strSearch to begin searchvQuoteLocs - Vector containing Integer objects whose intValue
specifies the location of a double quote (") in strText.
public static int locateNextSubstring(java.lang.String strSearch,
java.lang.String strFind,
int ipos)
strSearch - The string to searchstrFind - The substring to search foripos - int position within strSearch to begin search
public static java.lang.String removeAllNonQuotedWhitespace(java.lang.String strValue)
String that is strValue with
all non quoted whitespace (space and tab) removed. (keeps whitespace between double quotes)
strValue - The string to remove non-quoted whitespace
public static java.lang.String removeAllNonQuotedWhitespace(java.lang.String strValue,
java.util.Vector vQuoteLocs)
String that is strValue with
all non quoted whitespace (space and tab) removed. (keeps whitespace between double quotes)
strValue - The string to remove non-quoted whitespacevQuoteLocs - Vector containing Integer objects whose intValue
specifies the location of a double quote (") in strText.
public static java.lang.String replaceString(java.lang.String strSearch,
java.lang.String strReplace,
int ibegin,
int iend)
strSearch - The string to searchstrReplace - The replacement stringibegin - int location to begin replacementiend - int location to end replacement
public static java.lang.String reverse(java.lang.String s)
s - The string to reverse
public static boolean isLegalVarName(java.lang.String strVarName)
strVarName - The variable name to test
public static boolean isValidNonStdChar(char c)
c - The char to test
public static java.lang.String findAndReplace(java.lang.String input,
java.lang.String search,
java.lang.String replace)
public static java.lang.String spacePad(int ipad)
ipad -
public static boolean convertBool(java.lang.String bool)
bool -
public static java.lang.String removeRelativeFilePathPrefix(java.lang.String relativepath)
Example:
".\Datapool\Filename.ext" returns "Datapool\Filename.ext"
relativepath - String filepath to strip of leading relative path prefix characters.
public static java.lang.String removePrefix(java.lang.String original,
java.lang.String prefix)
Example:
original = "^filename=c:\file.txt" , prefix="^filename=" the result will be "c:\file.txt"
original - prefix -
public static java.lang.String removeSuffix(java.lang.String original,
java.lang.String suffix)
Example:
original = "^filename=c:\file.txt" , suffix="=c:\file.txt" the result will be "^filename"
original - suffix -
public static java.lang.String removeDoubleQuotes(java.lang.String original)
Example:
original = "c:\file.txt" (with quotes) the result will be 'c:\file.txt' (no quotes at all)
original -
public static java.lang.Integer convertToInteger(java.lang.String value)
throws SAFSException
value - A string represents an integer value.
SAFSException
public static java.awt.Rectangle formRectangle(java.lang.String rectangleString,
java.lang.String separator)
rectangleString - A string represent a rectangle: x, y , widht, height.separator - The separator in rectangleString to separate x y width and height
public static java.lang.String getDateString(java.util.Date date,
java.lang.String dateFormat)
date - A java.util.Date objectdateFormat - A string represents the date format pattern of SimpleDateFormat
public static java.lang.String getDateString(java.util.Date date)
date - A java.util.Date object
public static java.lang.String getTimeString(java.util.Date date,
boolean isMilitary)
date - A java.util.Date objectisMilitary - A boolean, if true, convert to a military time (24 hours format)
public static java.lang.String getDateTimeString(java.util.Date date,
boolean isMilitary)
date - A java.util.Date objectisMilitary - A boolean, if true, convert to a military time (24 hours format)
public static java.util.Date getDate(java.lang.String date,
java.lang.String dateFormat)
date - A string represents a date.dateFormat - A string represents the date format pattern of SimpleDateFormat
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||