|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjodd.util.StringUtil
General string utils.
Constructor Summary | |
StringUtil()
|
Method Summary | |
static boolean |
endsWithIgnoreCase(java.lang.String src,
java.lang.String subS)
Tests if this string ends with the specified suffix. |
static boolean |
equals(java.lang.String s1,
java.lang.String s2)
Compares 2 strings. |
static int |
indexOfIgnoreCase(java.lang.String src,
java.lang.String subS)
Finds first index of a substring in the given source string with ignored case. |
static int |
indexOfIgnoreCase(java.lang.String src,
java.lang.String subS,
int startIndex)
Finds first index of a substring in the given source string with ignored case. |
static boolean |
isEmpty(java.lang.String s)
Determines if a string is empty. |
static int |
lastIndexOfIgnoreCase(java.lang.String s,
java.lang.String subS)
Finds last index of a substring in the given source string with ignored case. |
static int |
lastIndexOfIgnoreCase(java.lang.String src,
java.lang.String subS,
int startIndex)
Finds last index of a substring in the given source string with ignored case. |
static java.lang.String |
replace(java.lang.String s,
char sub,
char with)
Character replacement in a string. |
static java.lang.String |
replace(java.lang.String s,
java.lang.String sub,
java.lang.String with)
Replaces the occurences of a certain pattern in a string with a replacement String. |
static java.lang.String |
setMaxLength(java.lang.String s,
int len)
Set the maximum length of the string. |
static java.lang.String[] |
split(java.lang.String src,
java.lang.String delimeter)
Splits a string in several parts (tokens) that are separated by delimeter. |
static java.lang.String[] |
splitc(java.lang.String src,
java.lang.String d)
Splits a string in several parts (tokens) that are separated by deliemter characters. |
static boolean |
startsWithIgnoreCase(java.lang.String src,
java.lang.String subS)
Tests if this string starts with the specified prefix with ignored case. |
static boolean |
startsWithIgnoreCase(java.lang.String src,
java.lang.String subS,
int startIndex)
Tests if this string starts with the specified prefix with ignored case and with the specified prefix beginning a specified index. |
static byte[] |
toByteArray(java.lang.String s)
Converts string into byte array. |
static java.lang.String |
toNotNullString(java.lang.Object obj)
Converts an object to a String. |
static java.lang.String |
toString(java.lang.Object obj)
Converts an object to a String. |
static java.lang.String[] |
toStringArray(java.lang.Object obj)
Converts an object to a String Array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StringUtil()
Method Detail |
public static java.lang.String replace(java.lang.String s, java.lang.String sub, java.lang.String with)
s
- the string to be inspectedsub
- the string pattern to be replacedwith
- the string that should go where the pattern was
public static java.lang.String replace(java.lang.String s, char sub, char with)
s
- input stringsub
- character to replacewith
- character to replace with
public static boolean equals(java.lang.String s1, java.lang.String s2)
s1
- first string to compares2
- second string
public static boolean isEmpty(java.lang.String s)
s
- string
public static java.lang.String setMaxLength(java.lang.String s, int len)
s
- stringlen
- max number of characters in string
public static java.lang.String toString(java.lang.Object obj)
null
it will be
not converted.
obj
- object to convert to string
null
public static java.lang.String toNotNullString(java.lang.Object obj)
null
a empty
string is returned.
obj
- object to convert to string
public static java.lang.String[] toStringArray(java.lang.Object obj)
obj
- object to convert to string array
public static java.lang.String[] split(java.lang.String src, java.lang.String delimeter)
String.split()
,
and a bit faster then StringTokenizer
.
src
- string to splitdelimeter
- split delimeter
public static java.lang.String[] splitc(java.lang.String src, java.lang.String d)
src
- source to examined
- string with delimeter characters
public static byte[] toByteArray(java.lang.String s)
s
- string to convert from
public static int indexOfIgnoreCase(java.lang.String src, java.lang.String subS)
src
- source string for examinationsubS
- substring to find
indexOfIgnoreCase(String, String, int)
public static int indexOfIgnoreCase(java.lang.String src, java.lang.String subS, int startIndex)
src
- source string for examinationsubS
- substring to findstartIndex
- starting index from where search begins
public static int lastIndexOfIgnoreCase(java.lang.String s, java.lang.String subS)
s
- subS
- substring to find
indexOfIgnoreCase(String, String, int)
,
lastIndexOfIgnoreCase(String, String, int)
public static int lastIndexOfIgnoreCase(java.lang.String src, java.lang.String subS, int startIndex)
src
- source string for examinationsubS
- substring to findstartIndex
- starting index from where search begins
indexOfIgnoreCase(String, String, int)
public static boolean startsWithIgnoreCase(java.lang.String src, java.lang.String subS)
src
- source string to testsubS
- starting substring
true
if the character sequence represented by the argument is
a prefix of the character sequence represented by this string;
false
otherwise.public static boolean startsWithIgnoreCase(java.lang.String src, java.lang.String subS, int startIndex)
src
- source string to testsubS
- starting substringstartIndex
- index from where to test
true
if the character sequence represented by the argument is
a prefix of the character sequence represented by this string;
false
otherwise.public static boolean endsWithIgnoreCase(java.lang.String src, java.lang.String subS)
src
- String to testsubS
- suffix
true
if the character sequence represented by the argument is
a suffix of the character sequence represented by this object;
false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |