java.lang.Object | |
↳ | com.microstrategy.utils.StringUtils |
This class provides static utility methods for doing string processing.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final String | NEWLINE |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
StringUtils() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static int |
compareFullServerVersion(String version1, String version2)
Compares IServer versions.
| ||||||||||
static int |
compareFullServerVersionInOrder(String version1, String version2)
Compares IServer versions.
| ||||||||||
static int |
compareServerVersion(String version1, String version2)
Compares IServer versions.
| ||||||||||
static String |
escape(String str, String toEscape, char escape)
Applies escape processing to the string parameter 'str'. | ||||||||||
static void |
escape(String str, String toEscape, char escape, StringBuilder escaped)
Applies escape processing to a string, and appends the results to a StringBuilder. | ||||||||||
static String |
getMessageIDFromSessionID(String sessionID)
Strips and returns the messageID from the session ID passed in.
| ||||||||||
static String |
getResultCodeFromSessionID(String sessionID)
Strips and returns the result code from the session ID passed in.
| ||||||||||
static String |
getServerNameFromSessionID(String sessionID)
Strips and returns the Intelligence Server name from the session ID passed in.
| ||||||||||
static String |
getSessionInfoFromSessionID(String sessionID)
Strips and returns the session info without message id and result code from the session ID passed in.
| ||||||||||
static boolean |
hasAsciiChars(String s)
Test if a string contains any non-ascii characters | ||||||||||
static String |
intArrayToString(int[] intArray)
Returns a string representation of an integer array.
| ||||||||||
static boolean | isEmpty(Object value) | ||||||||||
static boolean |
isEmpty(String value)
A String is considered empty if its null, or when trimmed has zero length. | ||||||||||
static boolean |
isEqual(String str1, String str2)
Checks whether two strings are equal.
| ||||||||||
static boolean | isEqual(Object obj1, Object obj2) | ||||||||||
static boolean | isEqualIgnoreCase(String str1, String str2) | ||||||||||
static boolean |
isEqualWithEmpty(String str1, String str2)
Checks whether two strings are equal.
| ||||||||||
static boolean |
isNotEmpty(String value)
Checks whether the specified string is null or an empty string after trimming.
| ||||||||||
static boolean |
isNotEqual(String str1, String str2)
Checks whether two string are not equal
| ||||||||||
static String |
mergeTokens(StringTokenizer strTok, String separator)
Concatenate all tokens in the StringTokenizer and delimit them by the
specified separator.
| ||||||||||
static String | parseFirstName(String fullName) | ||||||||||
static String | parseLastName(String fullName) | ||||||||||
static CharSequence |
replace(String str, char[] chars, String[] replaces)
Replaces the characters specified by the char[] with the String specified
in the String[].
| ||||||||||
static void |
replace(StringBuilder sb, char[] chars, String[] replaces)
Replaces the characters specified by the char[] with the String specified
in the String[].
| ||||||||||
static String | replaceCharsWithStrings(String str, char[] chars, String[] replaces) | ||||||||||
static String |
replaceString(String str, String pattern, String replace)
Replaces every ocurrence of XX with YY in the passed string.
| ||||||||||
static String[] |
split(String str, String delimiter)
Split the String into a string array, according to the delimiter
| ||||||||||
static ArrayList |
stringToIntArrayList(String str)
Splits the specified string into tokens based on the delimiter comma
and then stores them into an array list.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Compares IServer versions. Takes into account intermediate builds. Version structure: major.minor.release1.release2. Precendence is as follows: major, minor, release 2, release 1. Note that release 2 takes precedence over release 1. Returns 1 if version1 is higher than version2, -1 if version2 is higher, and 0 if they are equals.
version1 | MicroStrategy Intelligence Server version string. |
---|---|
version2 | MicroStrategy Intelligence Server version string. |
Compares IServer versions. Takes into account intermediate builds. Version structure: major.minor.release1.release2. Precendence is as follows: major, minor, release 1, release 2. Returns 1 if version1 is higher than version2, -1 if version2 is higher, and 0 if they are equals.
version1 | MicroStrategy Intelligence Server version string. |
---|---|
version2 | MicroStrategy Intelligence Server version string. |
Compares IServer versions. This method assumes that you are comparing 2 release versions and not intermediate builds. Therefore it only bases its comparison on the major release, minor release and revision 2 numbers. It does not care about revision 1. returns 1 if version1 > version 2 returns -1 if version2 > version 1 returns 0 if they are identical
version1 | MicroStrategy Intelligence Server version string. |
---|---|
version2 | MicroStrategy Intelligence Server version string. |
Applies escape processing to the string parameter 'str'. If any characters in 'str' contains any of the escapable characters defined in parameter 'toEscape', they are prefixed by the escape character specified. By default, the escape character does not escape itself - if this is desired, please ensure it's in the 'toEscape' string.
str | the original string |
---|---|
toEscape | characters to escape |
escape | the escape character |
Applies escape processing to a string, and appends the results to a StringBuilder.
escaped | Escaped string of 'str' |
---|
Strips and returns the messageID from the session ID passed in.
sessionID | an Intelligence Server session ID. |
---|
Strips and returns the result code from the session ID passed in.
sessionID | an Intelligence Server session ID. |
---|
Strips and returns the Intelligence Server name from the session ID passed in.
sessionID | an Intelligence Server session ID. |
---|
IllegalArgumentException | thrown if the session ID is invalid. |
---|
Strips and returns the session info without message id and result code from the session ID passed in.
sessionID | an Intelligence Server session ID. |
---|
Test if a string contains any non-ascii characters
s | A non-empty string |
---|
Returns a string representation of an integer array. All integer array elements are concatenated into a string and are delimited by a comma.
intArray | an integer array. |
---|
isEmpty(String)
A String is considered empty if its null, or when trimmed has zero length.
value | String to test |
---|
Checks whether two strings are equal. Note that a null string and one with only white space are considered NOT the same.
str1 | the first string to check equality |
---|---|
str2 | the second string to check equality |
true
if the two strings are the same (null and white space strings are considered different).Checks whether two strings are equal. Also checks for
isEmpty(String)
equivalence, i.e. a null string and one
with only white space are considered also equal.
str1 | the first string to check equality |
---|---|
str2 | the second string to check equality |
true
if the two strings are the same (null and white space strings are considered the same).Checks whether the specified string is null or an empty string after trimming.
value | the string to check. |
---|
true
if the specified string is not null and not empty after
trimming white space. Checks whether two string are not equal
str1 | the first string to check equality |
---|---|
str2 | the second string to check equality |
true
if the two strings are not equal.Concatenate all tokens in the StringTokenizer and delimit them by the specified separator.
strTok | a StringTokenizer containing string tokens |
---|---|
separator | the delimiter to separate strings |
Replaces the characters specified by the char[] with the String specified in the String[].
str | - Input String. |
---|---|
chars | - Array of Characters that need to be replaced. |
replaces | - Array of Strings that are replacements. |
Replaces the characters specified by the char[] with the String specified in the String[].
sb | - Input StringBuilder. |
---|---|
chars | - Array of Characters that need to be replaced. |
replaces | - Array of Strings that are replacements. |
Replaces every ocurrence of XX with YY in the passed string.
The various replace functions in String are recommended
over this legacy function (which preceded the String
functions). This method will be deprecated at some point.
str | the string on which to perform the replacement |
---|---|
pattern | the substring to replace(XX) - note that this is NOT a regular expression |
replace | the replacement substring(YY) |
Split the String into a string array, according to the delimiter
str | the string on which to perform the spliting. |
---|---|
delimiter | the delimiter string. |
Splits the specified string into tokens based on the delimiter comma and then stores them into an array list.
str | a string delimited by comma. |
---|