|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.openfoundation.util.XPStringUtility
public class XPStringUtility
XPStringUtility contains the utility methods that operate on strings.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_ENCODING
Default byte encoding for characters and strings. |
Constructor Summary | |
---|---|
XPStringUtility()
|
Method Summary | |
---|---|
static char |
CharAt(java.lang.String source,
int index)
Return the value of the character at the specified index in the source string, for a non-null source and an index in bounds. |
static int |
Compare(java.lang.String stringA,
java.lang.String stringB)
Compares two strings and returns an integer value that represents if the given strings are equal or stringA is greater that stringB or stringA is less than stringB. |
static int |
CompareIgnoreCase(java.lang.String stringA,
java.lang.String stringB)
Compares two strings and returns an integer value that represents if the given strings are equal or stringA is greater that stringB or stringA is less than stringB. |
static boolean |
EndsWith(java.lang.String source,
java.lang.String token)
Tests if this string ends with the specified suffix. |
static boolean |
EqualsIgnoreCase(java.lang.String stringA,
java.lang.String stringB)
Compares two strings, ignoring case considerations. |
static java.lang.String |
ForceEndsWith(java.lang.String strIn,
java.lang.String strEndsWith)
This method forces strIn to end with strEndsWith. |
static byte[] |
GetBytes(java.lang.String str)
Encodes this string into a sequence of bytes using the platform's default charset, storing the result into a new byte array. |
static char[] |
GetChars(java.lang.String str)
Encodes this string into a sequence of chars, storing the result into a new char array. |
static int |
IndexOf(java.lang.String source,
char ch)
Wraps String source.indexOf(ch), returning -1 if the character is not found. |
static int |
IndexOf(java.lang.String source,
char ch,
int fromIndex)
Wraps String source.indexOf(ch, fromIndex), returning -1 if the character is not found. |
static int |
IndexOf(java.lang.String source,
java.lang.String token)
Wraps String source.indexOf(token), returning -1 if the token is not found. |
static int |
IndexOf(java.lang.String source,
java.lang.String token,
int fromIndex)
Wraps String source.indexOf(token, fromIndex), returning -1 if the token is not found. |
static int |
LastIndexOf(java.lang.String source,
char ch)
Wraps String source.lastIndexOf(ch), returning -1 if the character is not found. |
static int |
LastIndexOf(java.lang.String source,
char ch,
int fromIndex)
Wraps String source.lastIndexOf(ch, fromIndex), returning -1 if the character is not found. |
static int |
LastIndexOf(java.lang.String source,
java.lang.String token)
Wraps String source.lastIndexOf(token), returning -1 if the token is not found. |
static int |
LastIndexOf(java.lang.String source,
java.lang.String token,
int fromIndex)
Wraps String source.lastIndexOf(token, fromIndex), returning -1 if the token is not found. |
static boolean |
StartsWith(java.lang.String source,
java.lang.String token)
Tests if this string starts with the specified prefix. |
static java.lang.String |
Substring(java.lang.String source,
int startIndex)
Returns a new string that is a substring of this string. |
static java.lang.String |
Substring(java.lang.String source,
int startIndex,
int endIndex)
Returns a new string that is a substring of this string. |
static java.lang.String |
ToLowerCase(java.lang.String source)
Converts the supplied String instance to lower case. |
static java.lang.String |
ToLowerCase(java.lang.String source,
XPLocale locale)
Converts the supplied String instance to lower case with regard to the supplied locale. |
static java.lang.String |
ToUpperCase(java.lang.String source)
Converts the supplied String instance to upper case. |
static java.lang.String |
ToUpperCase(java.lang.String source,
XPLocale locale)
Converts the supplied String instance to upper case with regard to the supplied locale. |
static java.lang.String |
Trim(java.lang.String str)
Returns a new string instance based on the source, trimmed of leading and trailing whitespace. |
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 DEFAULT_ENCODING
Constructor Detail |
---|
public XPStringUtility()
Method Detail |
---|
public static char CharAt(java.lang.String source, int index)
source
- a non-null source string.index
- value in bounds.
public static int Compare(java.lang.String stringA, java.lang.String stringB)
stringA
- The first stringstringB
- The second string
public static int CompareIgnoreCase(java.lang.String stringA, java.lang.String stringB)
stringA
- The first stringstringB
- The second string
public static boolean EndsWith(java.lang.String source, java.lang.String token)
source
- A non null string.token
- the suffix.
true
if the character sequence represented by the
argument is a suffix of the character sequence represented by
this object; false
otherwise. Note that the
result will be true
if the argument is the
empty string or is equal to this String
objectpublic static boolean EqualsIgnoreCase(java.lang.String stringA, java.lang.String stringB)
stringA
- The first stringstringB
- The second string
public static java.lang.String ForceEndsWith(java.lang.String strIn, java.lang.String strEndsWith)
strIn
- The string that you want to end with some other stringstrEndsWith
- The string you want strIn to end with
public static byte[] GetBytes(java.lang.String str)
str
- The input string
public static char[] GetChars(java.lang.String str)
str
- The input string
public static int IndexOf(java.lang.String source, char ch)
source
- non-null source stringch
- character to find in source
XPIllegalArgumentException
- if source is null.public static int IndexOf(java.lang.String source, char ch, int fromIndex)
source
- non-null source stringch
- character to find in sourcefromIndex
- index in source to start looking for token, 0 <= index < source length.
ch
at or after fromIndex
, or -1 if not found.
XPIllegalArgumentException
- if source is null or fromIndex is out of range.public static int IndexOf(java.lang.String source, java.lang.String token)
source
- non-null source stringtoken
- substring to find in source
token
in source string, or -1 if not found.
XPIllegalArgumentException
- if source or token is null, or token is empty.public static int IndexOf(java.lang.String source, java.lang.String token, int fromIndex)
source
- non-null source stringtoken
- substring to find in sourcefromIndex
- index in source to start looking for token, 0 <= index < source length.
XPIllegalArgumentException
- if source or token is null or token is empty or fromIndex is out of range.public static int LastIndexOf(java.lang.String source, char ch)
source
- non-null source stringch
- character to find in source
XPIllegalArgumentException
- if source is null.public static int LastIndexOf(java.lang.String source, char ch, int fromIndex)
source
- non-null source stringch
- character to findfromIndex
- index in source to start looking for ch, 0 <= index < source length.
XPIllegalArgumentException
- if source is null or fromIndex is out of bounds.public static int LastIndexOf(java.lang.String source, java.lang.String token)
source
- non-null source stringtoken
- substring to find in source
XPIllegalArgumentException
- if source is null, token is null, or token is empty string.public static int LastIndexOf(java.lang.String source, java.lang.String token, int fromIndex)
source
- non-null source stringtoken
- substring to find in sourcefromIndex
- index in source to start looking for token, 0 <= index < source length.
XPIllegalArgumentException
- if source is null, token is null,
token is empty string, or fromIndex is out of range.public static boolean StartsWith(java.lang.String source, java.lang.String token)
source
- String.token
- the prefix.
true
if the character sequence represented by the
argument is a prefix of the character sequence represented by
this string; false
otherwise.
Note also that true
will be returned if the
argument is an empty string or is equal to this
String
object.public static java.lang.String Substring(java.lang.String source, int startIndex)
source
- String.startIndex
- the beginning index, inclusive.
public static java.lang.String Substring(java.lang.String source, int startIndex, int endIndex)
beginIndex
and
extends to the character at index endIndex - 1
.
Thus the length of the substring is endIndex-beginIndex
.
source
- String.startIndex
- the beginning index, inclusive.endIndex
- the ending index, exclusive.
public static java.lang.String ToLowerCase(java.lang.String source)
source
- String.
XPIllegalArgumentException
- when source string is null.public static java.lang.String ToLowerCase(java.lang.String source, XPLocale locale)
source
- String.locale
- XPLocale that's supplied.
XPIllegalArgumentException
- when source string is null.public static java.lang.String ToUpperCase(java.lang.String source)
source
- String.
XPIllegalArgumentException
- when source string is null.public static java.lang.String ToUpperCase(java.lang.String source, XPLocale locale)
source
- String.locale
- supplied locale.
XPIllegalArgumentException
- when source string is null.public static java.lang.String Trim(java.lang.String str)
str
- non-null source string
XPIllegalArgumentException
- if str is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |