|
OBEROn SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.oberon.util.StringUtils
public class StringUtils
Utilities for String manipulation
Field Summary | |
---|---|
static java.lang.String |
UTF8
UTF-8 constant |
Constructor Summary | |
---|---|
StringUtils()
|
Method Summary | |
---|---|
static java.lang.String |
addNewLines(java.lang.String text)
Add new line after the period and colon characters |
static java.lang.String |
arrayToString(java.lang.String[] array,
java.lang.String delimiter)
Append all string array elements (separated by the delimiter) to a single string |
static byte[] |
base64Decode(java.lang.String text)
Decode a base64 format to a binary array |
static java.lang.String |
base64Encode(byte[] textbuffer)
Encode to base64 format a binary array |
static java.lang.String |
capitalize(java.lang.String text)
Convert to upper case the first character of any words in a text |
static boolean |
checkPattern(java.util.Vector<java.lang.String> patterns,
java.lang.String text)
Check if a text match one of given patterns |
static boolean |
checkPatterns(java.util.Vector<java.lang.String> patterns,
java.util.Vector<java.lang.String> elements)
Check if one of the element of a Vector match one of given patterns |
static java.lang.String |
escape(java.lang.String value)
Escape single and double quotes inside a string |
static java.lang.String |
escapeDB(java.lang.String value)
Escape single quotes inside a string |
static java.lang.String |
escapeNL(java.lang.String value)
Replace new line character with carriage return |
static java.lang.String |
escapePattern(java.lang.String value)
Escape single and double quotes inside a pattern string |
static java.lang.String |
formatValue(java.lang.String value,
java.lang.String formatTags,
java.util.Locale locale)
Apply a format to a value according to the specific format tags and current locale |
static java.lang.String |
generateSessionId(java.lang.String user,
java.lang.String password)
Use the user account to generate a session ID |
static java.lang.String |
getStringPart(java.lang.String sourceText,
int[] coords)
Get sub-string included between two points |
static java.lang.String |
getStringPart(java.lang.String sourceText,
java.lang.String leftBound,
java.lang.String rightBound)
Get the first occurrence of sub-string included between two bound sub-strings (left and right) |
static java.lang.String |
getTagValue(java.lang.String format,
java.lang.String tag)
Extract a tag value from a form-item format value |
static java.lang.String |
hashPassword(java.lang.String password)
Generate hashed password with 16 characters |
static java.lang.String |
hashPassword(java.lang.String password,
int numchars)
Generate hashed password with the given length |
static boolean |
isBlank(java.lang.String str)
Check is a string is blank: is null, has length=0 or all character are white spaces |
static boolean |
matchPattern(java.lang.String pattern,
java.lang.String text)
Check if a text match a given pattern |
static int[] |
matchVectors(java.util.Vector<java.lang.String> v1,
java.util.Vector<java.lang.String> v2,
boolean checkRename)
Search objects with same name, return a int array like: {-1 1 -1 -1 3 4 -1 5} where the numbers indicate the position of elements of vector v1 inside the vector v2 |
static void |
orderStringVector(java.util.Vector<?> vector,
boolean increase)
Sort a vector |
static java.lang.String[] |
parseSessionId(java.lang.String sessionId)
Extract the account info from a session ID |
static java.lang.String |
patternVectorToString(java.util.Vector<java.lang.String> vector,
java.lang.String delimiter)
Append all pattern vector elements (separated by the delimiter) to a single string |
static java.lang.String |
removeQuotes(java.lang.String sSource)
Remove the quotes at the start and the end of a string |
static java.lang.String |
replaceString(java.lang.String source,
java.lang.String replace,
java.lang.String substitute)
Replace all occurrences of a sub-string into a given string with another substitute sub-string |
static java.lang.String[] |
StringTokensToArray(java.lang.String stringToTokenize,
java.lang.String delimiter)
Split a string by the delimiter and add the tokens to a String array |
static java.util.Vector<java.lang.String> |
StringTokensToVector(java.lang.String stringToTokenize,
java.lang.String delimiter)
Split a string by the delimiter and add the tokens to a Vector |
static java.lang.String |
toAlphaNumeric(java.lang.String text)
Convert accented characters to the similar alphabetical character |
static java.lang.String |
unescape(java.lang.String value)
Remove the escape character for single and double quotes |
static java.lang.String |
unformatValue(java.lang.String value,
java.lang.String formatTags,
java.util.Locale locale)
Remove the format from a value according to the specific format tags and current locale |
static java.lang.String |
vectorToString(java.util.Vector<?> vector,
java.lang.String delimiter)
Append all vector elements (separated by the delimiter) to a single string |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String UTF8
Constructor Detail |
---|
public StringUtils()
Method Detail |
---|
public static java.lang.String escapeDB(java.lang.String value)
public static java.lang.String escape(java.lang.String value)
public static java.lang.String escapeNL(java.lang.String value)
public static java.lang.String escapePattern(java.lang.String value)
public static java.lang.String unescape(java.lang.String value)
public static java.lang.String removeQuotes(java.lang.String sSource)
public static java.lang.String capitalize(java.lang.String text)
public static java.lang.String addNewLines(java.lang.String text)
public static java.lang.String toAlphaNumeric(java.lang.String text)
public static java.lang.String hashPassword(java.lang.String password)
public static java.lang.String hashPassword(java.lang.String password, int numchars)
public static java.lang.String base64Encode(byte[] textbuffer)
public static byte[] base64Decode(java.lang.String text) throws java.lang.Exception
java.lang.Exception
public static java.lang.String generateSessionId(java.lang.String user, java.lang.String password) throws java.lang.Exception
user
- the user namepassword
- the account password
java.lang.Exception
public static java.lang.String[] parseSessionId(java.lang.String sessionId) throws java.lang.Exception
java.lang.Exception
public static java.lang.String vectorToString(java.util.Vector<?> vector, java.lang.String delimiter)
public static java.lang.String patternVectorToString(java.util.Vector<java.lang.String> vector, java.lang.String delimiter)
public static java.lang.String arrayToString(java.lang.String[] array, java.lang.String delimiter)
public static java.util.Vector<java.lang.String> StringTokensToVector(java.lang.String stringToTokenize, java.lang.String delimiter)
public static java.lang.String[] StringTokensToArray(java.lang.String stringToTokenize, java.lang.String delimiter)
public static boolean isBlank(java.lang.String str)
public static java.lang.String getStringPart(java.lang.String sourceText, java.lang.String leftBound, java.lang.String rightBound)
sourceText
- the source stringleftBound
- the left side sub-stringrightBound
- the right side sub-string
Example: getStringPart("user[MyName]","user[","]") return "MyName"public static java.lang.String getStringPart(java.lang.String sourceText, int[] coords)
sourceText
- the source stringcoords
- points coordinates: int[4] { row0 , col0 , row1 , col1 }public static java.lang.String getTagValue(java.lang.String format, java.lang.String tag)
format
- the format stringtag
- the tag namepublic static java.lang.String replaceString(java.lang.String source, java.lang.String replace, java.lang.String substitute)
source
- the source stringreplace
- the sub-string to replacesubstitute
- the substitute sub-string
Example: replaceString("My source string"," s"," S") return "My Source String"public static void orderStringVector(java.util.Vector<?> vector, boolean increase)
vector
- the vector to sortincrease
- if true order from less values to high valuespublic static int[] matchVectors(java.util.Vector<java.lang.String> v1, java.util.Vector<java.lang.String> v2, boolean checkRename)
checkRename
- if true, try to map not found elements even if they don't matchpublic static boolean matchPattern(java.lang.String pattern, java.lang.String text)
pattern
- the pattern (use wildcards "*" match 0/n chars and "?" match a single char)text
- the text to verify
Example:
matchPattern("*Nam?","MyName") return true
matchPattern("*Nam?","MyNames") return falsepublic static boolean checkPattern(java.util.Vector<java.lang.String> patterns, java.lang.String text)
patterns
- Vector of the pattern (use wildcards "*" match 0/n chars and "?" match a single char)text
- the text to verifypublic static boolean checkPatterns(java.util.Vector<java.lang.String> patterns, java.util.Vector<java.lang.String> elements)
patterns
- Vector of the pattern (use wildcards "*" match 0/n chars and "?" match a single char)elements
- list of elements to verifypublic static java.lang.String formatValue(java.lang.String value, java.lang.String formatTags, java.util.Locale locale)
value
- the value to formatformatTags
- the format string including the value format taglocale
- current locale
public static java.lang.String unformatValue(java.lang.String value, java.lang.String formatTags, java.util.Locale locale) throws java.lang.Exception
value
- the value to formatformatTags
- the format string including the value format taglocale
- current locale
java.lang.Exception
|
OBEROn SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |