jodd.util
Class StringUtil

java.lang.Object
  extended by jodd.util.StringUtil

public class StringUtil
extends java.lang.Object

Various String utilities.


Field Summary
static java.lang.String WHITESPACE
           
 
Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String capitalize(java.lang.String str)
          Capitalizes a string, changing the first letter to upper case.
static java.lang.String convertCharset(java.lang.String source, java.lang.String srcCharsetName, java.lang.String newCharsetName)
          Converts string charsets.
static int count(java.lang.String source, char c)
           
static int count(java.lang.String source, char c, int start)
           
static int count(java.lang.String source, java.lang.String sub)
          Count substring occurrences in a source string.
static int count(java.lang.String source, java.lang.String sub, int start)
           
static int countIgnoreCase(java.lang.String source, java.lang.String sub)
          Count substring occurrences in a source string, ignoring case.
static boolean endsWithIgnoreCase(java.lang.String src, java.lang.String subS)
          Tests if this string ends with the specified suffix.
static int endsWithOne(java.lang.String src, java.lang.String[] dest)
          Checks if string ends with at least one string from the provided array.
static int endsWithOneIgnoreCase(java.lang.String src, java.lang.String[] dest)
          Checks if string ends with at least one string from the provided array.
static boolean equals(java.lang.String[] as, java.lang.String[] as1)
          Compares two string arrays.
static boolean equals(java.lang.String s1, java.lang.String s2)
          Compares 2 strings.
static boolean equalsIgnoreCase(java.lang.String[] as, java.lang.String[] as1)
          Compares two string arrays.
static int equalsOne(java.lang.String src, java.lang.String[] dest)
          Compares string with at least one from the provided array.
static int equalsOneIgnoreCase(java.lang.String src, java.lang.String[] dest)
          Compares string with at least one from the provided array, ignoring case.
static int indexOf(java.lang.String src, char c, int startIndex, int endIndex)
          Finds the first occurrence of a character in the given source but within limited range (start, end].
static int[] indexOf(java.lang.String s, java.lang.String[] arr)
          Finds the very first index of a substring from the specified array.
static int[] indexOf(java.lang.String s, java.lang.String[] arr, int start)
          Finds the very first index of a substring from the specified array.
static int indexOf(java.lang.String src, java.lang.String sub, int startIndex, int endIndex)
          Finds first occurrence of a substring in the given source but within limited range [start, end).
static int indexOfChars(java.lang.String string, char[] chars)
           
static int indexOfChars(java.lang.String string, char[] chars, int startindex)
          Returns the very first index of any char from provided string, starting from specified index offset.
static int indexOfChars(java.lang.String string, java.lang.String chars)
           
static int indexOfChars(java.lang.String string, java.lang.String chars, int startindex)
          Returns the very first index of any char from provided string, starting from specified index offset.
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 s, java.lang.String[] arr)
          Finds the very first index of a substring from the specified array.
static int[] indexOfIgnoreCase(java.lang.String s, java.lang.String[] arr, int start)
          Finds the very first index of a substring from the specified array.
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 int indexOfIgnoreCase(java.lang.String src, java.lang.String sub, int startIndex, int endIndex)
          Finds first index of a substring in the given source string and range with ignored case.
static int[] indexOfRegion(java.lang.String string, java.lang.String leftBoundary, java.lang.String rightBoundary)
           
static int[] indexOfRegion(java.lang.String string, java.lang.String leftBoundary, java.lang.String rightBoundary, char escape)
           
static int[] indexOfRegion(java.lang.String string, java.lang.String leftBoundary, java.lang.String rightBoundary, char escape, int offset)
          Returns indexes of the first string region.
static int[] indexOfRegion(java.lang.String string, java.lang.String leftBoundary, java.lang.String rightBoundary, int offset)
          Returns indexes of the first region without escaping character.
static boolean isBlank(java.lang.String string)
          Determines if a string is blank (null or trimmed empty)
static boolean isEmpty(java.lang.String string)
          Determines if a string is empty (null or empty).
static boolean isNotEmpty(java.lang.String string)
          Determines if a string is not empty.
static int lastIndexOf(java.lang.String src, char c, int startIndex, int endIndex)
          Finds last index of a character in the given source string in specified range [end, start]
static int[] lastIndexOf(java.lang.String s, java.lang.String[] arr)
          Finds the very last index of a substring from the specified array.
static int[] lastIndexOf(java.lang.String s, java.lang.String[] arr, int fromIndex)
          Finds the very last index of a substring from the specified array.
static int lastIndexOf(java.lang.String src, java.lang.String sub, int startIndex, int endIndex)
          Finds last index of a substring in the given source string in specified range [end, start] See indexOf(String, String, int, int) for details about the speed.
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 s, java.lang.String[] arr)
          Finds the very last index of a substring from the specified array.
static int[] lastIndexOfIgnoreCase(java.lang.String s, java.lang.String[] arr, int fromIndex)
          Finds the very last index of a substring from the specified array.
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 int lastIndexOfIgnoreCase(java.lang.String src, java.lang.String sub, int startIndex, int endIndex)
          Finds last index of a substring in the given source string with ignored case in specified range.
static java.lang.String remove(java.lang.String src, char chars)
          Removes a single character from string.
static java.lang.String remove(java.lang.String s, java.lang.String sub)
          Removes all substring occurrences from the string.
static java.lang.String removeChars(java.lang.String src, char[] chars)
          Removes set of characters from string.
static java.lang.String removeChars(java.lang.String src, java.lang.String chars)
          Removes all characters contained in provided string.
static java.lang.String replace(java.lang.String s, char sub, char with)
          Replaces all occurrences of a character in a string.
static java.lang.String replace(java.lang.String s, java.lang.String[] sub, java.lang.String[] with)
          Replaces many substring at once.
static java.lang.String replace(java.lang.String s, java.lang.String sub, java.lang.String with)
          Replaces the occurrences of a certain pattern in a string with a replacement string.
static java.lang.String replaceFirst(java.lang.String s, char sub, char with)
          Replaces the very first occurrence of a character in a string.
static java.lang.String replaceFirst(java.lang.String s, java.lang.String sub, java.lang.String with)
          Replaces the very first occurrence of a substring with supplied string.
static java.lang.String replaceIgnoreCase(java.lang.String s, java.lang.String[] sub, java.lang.String[] with)
          Replaces many substring at once.
static java.lang.String replaceLast(java.lang.String s, char sub, char with)
          Replaces the very last occurrence of a character in a string.
static java.lang.String replaceLast(java.lang.String s, java.lang.String sub, java.lang.String with)
          Replaces the very last occurrence of a substring with supplied 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 delimiter.
static java.lang.String[] splitc(java.lang.String src, char delimiter)
          Splits a string in several parts (tokens) that are separated by single delimiter characters.
static java.lang.String[] splitc(java.lang.String src, java.lang.String d)
          Splits a string in several parts (tokens) that are separated by delimiter 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 int startsWithOne(java.lang.String src, java.lang.String[] dest)
          Checks if string starts with at least one string from the provided array.
static int startsWithOneIgnoreCase(java.lang.String src, java.lang.String[] dest)
          Checks if string starts with at least one string from the provided array.
static java.lang.String toNotNullString(java.lang.Object obj)
          Converts safely an object to a string.
static java.lang.String toString(java.lang.Object obj)
          Converts safely an object to a string.
static java.lang.String[] toStringArray(java.lang.Object obj)
          Converts an object to a String Array.
static void trim(java.lang.String[] strings)
          Trims array of strings.
static java.lang.String trimNonEmpty(java.lang.String string)
          Trims string where empty strings are returned as a null.
static void trimNonEmpty(java.lang.String[] strings)
          Trims array of strings where empty strings are nulled.
static java.lang.String truncate(java.lang.String string, int length)
          Sets the maximum length of the string.
static java.lang.String uncapitalize(java.lang.String str)
          Uncapitalizes a String, changing the first letter to lower case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITESPACE

public static final java.lang.String WHITESPACE
See Also:
Constant Field Values
Constructor Detail

StringUtil

public StringUtil()
Method Detail

replace

public static java.lang.String replace(java.lang.String s,
                                       java.lang.String sub,
                                       java.lang.String with)
Replaces the occurrences of a certain pattern in a string with a replacement string. This is the fastest replace function known to author.

Parameters:
s - string to be inspected
sub - string pattern to be replaced
with - string that should go where the pattern was

replace

public static java.lang.String replace(java.lang.String s,
                                       char sub,
                                       char with)
Replaces all occurrences of a character in a string.

Parameters:
s - input string
sub - character to replace
with - character to replace with

replaceFirst

public static java.lang.String replaceFirst(java.lang.String s,
                                            java.lang.String sub,
                                            java.lang.String with)
Replaces the very first occurrence of a substring with supplied string.

Parameters:
s - source string
sub - substring to replace
with - substring to replace with

replaceFirst

public static java.lang.String replaceFirst(java.lang.String s,
                                            char sub,
                                            char with)
Replaces the very first occurrence of a character in a string.

Parameters:
s - string
sub - char to replace
with - char to replace with

replaceLast

public static java.lang.String replaceLast(java.lang.String s,
                                           java.lang.String sub,
                                           java.lang.String with)
Replaces the very last occurrence of a substring with supplied string.

Parameters:
s - source string
sub - substring to replace
with - substring to replace with

replaceLast

public static java.lang.String replaceLast(java.lang.String s,
                                           char sub,
                                           char with)
Replaces the very last occurrence of a character in a string.

Parameters:
s - string
sub - char to replace
with - char to replace with

remove

public static java.lang.String remove(java.lang.String s,
                                      java.lang.String sub)
Removes all substring occurrences from the string.

Parameters:
s - source string
sub - substring to remove

removeChars

public static java.lang.String removeChars(java.lang.String src,
                                           java.lang.String chars)
Removes all characters contained in provided string.

Parameters:
src - source string
chars - string containing characters to remove

removeChars

public static java.lang.String removeChars(java.lang.String src,
                                           char[] chars)
Removes set of characters from string.

Parameters:
src - string
chars - character to remove

remove

public static java.lang.String remove(java.lang.String src,
                                      char chars)
Removes a single character from string.

Parameters:
src - source string
chars - character to remove

equals

public static boolean equals(java.lang.String s1,
                             java.lang.String s2)
Compares 2 strings. If one of the strings is null, false is returned. if both string are null, true is returned.

Parameters:
s1 - first string to compare
s2 - second string
Returns:
true if strings are equal, otherwise false

isEmpty

public static boolean isEmpty(java.lang.String string)
Determines if a string is empty (null or empty).


isBlank

public static boolean isBlank(java.lang.String string)
Determines if a string is blank (null or trimmed empty).,


isNotEmpty

public static boolean isNotEmpty(java.lang.String string)
Determines if a string is not empty.


toString

public static java.lang.String toString(java.lang.Object obj)
Converts safely an object to a string. If object is null it will be not converted.


toNotNullString

public static java.lang.String toNotNullString(java.lang.Object obj)
Converts safely an object to a string. If object is null a empty string is returned.


toStringArray

public static java.lang.String[] toStringArray(java.lang.Object obj)
Converts an object to a String Array.


capitalize

public static java.lang.String capitalize(java.lang.String str)
Capitalizes a string, changing the first letter to upper case. No other letters are changed.

Parameters:
str - string to capitalize, may be null
See Also:
uncapitalize(String)

uncapitalize

public static java.lang.String uncapitalize(java.lang.String str)
Uncapitalizes a String, changing the first letter to lower case. No other letters are changed.

Parameters:
str - the String to uncapitalize, may be null
Returns:
the uncapitalized String, null if null
See Also:
capitalize(String)

truncate

public static java.lang.String truncate(java.lang.String string,
                                        int length)
Sets the maximum length of the string. Longer strings will be simply truncated.


split

public static java.lang.String[] split(java.lang.String src,
                                       java.lang.String delimeter)
Splits a string in several parts (tokens) that are separated by delimiter. Delimiter is always surrounded by two strings! If there is no content between two delimiters, empty string will be returned for that token. Therefore, the length of the returned array will always be: #delimiters + 1.

Method is much, much faster then regexp String.split(), and a bit faster then StringTokenizer.

Parameters:
src - string to split
delimeter - split delimiter
Returns:
array of split strings

splitc

public static java.lang.String[] splitc(java.lang.String src,
                                        java.lang.String d)
Splits a string in several parts (tokens) that are separated by delimiter characters. Delimiter may contains any number of character, and it is always surrounded by two strings.

Parameters:
src - source to examine
d - string with delimiter characters
Returns:
array of tokens

splitc

public static java.lang.String[] splitc(java.lang.String src,
                                        char delimiter)
Splits a string in several parts (tokens) that are separated by single delimiter characters. Delimiter may contains any number of character, and it is always surrounded by two strings.

Parameters:
src - source to examine
delimiter - delimiter character
Returns:
array of tokens

indexOf

public static int indexOf(java.lang.String src,
                          java.lang.String sub,
                          int startIndex,
                          int endIndex)
Finds first occurrence of a substring in the given source but within limited range [start, end). It is fastest possible code, but still original String.indexOf(String, int) is much faster (since it uses char[] value directly) and should be used when no range is needed.

Parameters:
src - source string for examination
sub - substring to find
startIndex - starting index
endIndex - ending index
Returns:
index of founded substring or -1 if substring not found

indexOf

public static int indexOf(java.lang.String src,
                          char c,
                          int startIndex,
                          int endIndex)
Finds the first occurrence of a character in the given source but within limited range (start, end].


indexOfIgnoreCase

public 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.

Parameters:
src - source string for examination
subS - substring to find
Returns:
index of founded substring or -1 if substring is not found
See Also:
indexOfIgnoreCase(String, String, int)

indexOfIgnoreCase

public 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. This seems to be the fastest way doing this, with common string length and content (of course, with no use of Boyer-Mayer type of algorithms). Other implementations are slower: getting char array first, lower casing the source string, using String.regionMatch etc.

Parameters:
src - source string for examination
subS - substring to find
startIndex - starting index from where search begins
Returns:
index of founded substring or -1 if substring is not found

indexOfIgnoreCase

public static int indexOfIgnoreCase(java.lang.String src,
                                    java.lang.String sub,
                                    int startIndex,
                                    int endIndex)
Finds first index of a substring in the given source string and range with ignored case.

Parameters:
src - source string for examination
sub - substring to find
startIndex - starting index from where search begins
endIndex - endint index
Returns:
index of founded substring or -1 if substring is not found
See Also:
indexOfIgnoreCase(String, String, int)

lastIndexOfIgnoreCase

public 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.

Parameters:
s - source string
subS - substring to find
Returns:
last index of founded substring or -1 if substring is not found
See Also:
indexOfIgnoreCase(String, String, int), lastIndexOfIgnoreCase(String, String, int)

lastIndexOfIgnoreCase

public 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.

Parameters:
src - source string for examination
subS - substring to find
startIndex - starting index from where search begins
Returns:
last index of founded substring or -1 if substring is not found
See Also:
indexOfIgnoreCase(String, String, int)

lastIndexOfIgnoreCase

public static int lastIndexOfIgnoreCase(java.lang.String src,
                                        java.lang.String sub,
                                        int startIndex,
                                        int endIndex)
Finds last index of a substring in the given source string with ignored case in specified range.

Parameters:
src - source to examine
sub - substring to find
startIndex - starting index
endIndex - end index
Returns:
last index of founded substring or -1 if substring is not found

lastIndexOf

public static int lastIndexOf(java.lang.String src,
                              java.lang.String sub,
                              int startIndex,
                              int endIndex)
Finds last index of a substring in the given source string in specified range [end, start] See indexOf(String, String, int, int) for details about the speed.

Parameters:
src - source to examine
sub - substring to find
startIndex - starting index
endIndex - end index
Returns:
last index of founded substring or -1 if substring is not found

lastIndexOf

public static int lastIndexOf(java.lang.String src,
                              char c,
                              int startIndex,
                              int endIndex)
Finds last index of a character in the given source string in specified range [end, start]


startsWithIgnoreCase

public static boolean startsWithIgnoreCase(java.lang.String src,
                                           java.lang.String subS)
Tests if this string starts with the specified prefix with ignored case.

Parameters:
src - source string to test
subS - starting substring
Returns:
true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise.

startsWithIgnoreCase

public 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.

Parameters:
src - source string to test
subS - starting substring
startIndex - index from where to test
Returns:
true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise.

endsWithIgnoreCase

public static boolean endsWithIgnoreCase(java.lang.String src,
                                         java.lang.String subS)
Tests if this string ends with the specified suffix.

Parameters:
src - String to test
subS - suffix
Returns:
true if the character sequence represented by the argument is a suffix of the character sequence represented by this object; false otherwise.

count

public static int count(java.lang.String source,
                        java.lang.String sub)
Count substring occurrences in a source string.

Parameters:
source - source string
sub - substring to count
Returns:
number of substring occurrences

count

public static int count(java.lang.String source,
                        java.lang.String sub,
                        int start)

count

public static int count(java.lang.String source,
                        char c)

count

public static int count(java.lang.String source,
                        char c,
                        int start)

countIgnoreCase

public static int countIgnoreCase(java.lang.String source,
                                  java.lang.String sub)
Count substring occurrences in a source string, ignoring case.

Parameters:
source - source string
sub - substring to count
Returns:
number of substring occurrences

indexOf

public static int[] indexOf(java.lang.String s,
                            java.lang.String[] arr)
Finds the very first index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
Returns:
int[2]

indexOf

public static int[] indexOf(java.lang.String s,
                            java.lang.String[] arr,
                            int start)
Finds the very first index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
start - starting position
Returns:
int[2]

indexOfIgnoreCase

public static int[] indexOfIgnoreCase(java.lang.String s,
                                      java.lang.String[] arr)
Finds the very first index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
Returns:
int[2]

indexOfIgnoreCase

public static int[] indexOfIgnoreCase(java.lang.String s,
                                      java.lang.String[] arr,
                                      int start)
Finds the very first index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
start - starting position
Returns:
int[2]

lastIndexOf

public static int[] lastIndexOf(java.lang.String s,
                                java.lang.String[] arr)
Finds the very last index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
Returns:
int[2]

lastIndexOf

public static int[] lastIndexOf(java.lang.String s,
                                java.lang.String[] arr,
                                int fromIndex)
Finds the very last index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
fromIndex - starting position
Returns:
int[2]

lastIndexOfIgnoreCase

public static int[] lastIndexOfIgnoreCase(java.lang.String s,
                                          java.lang.String[] arr)
Finds the very last index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
Returns:
int[2]

lastIndexOfIgnoreCase

public static int[] lastIndexOfIgnoreCase(java.lang.String s,
                                          java.lang.String[] arr,
                                          int fromIndex)
Finds the very last index of a substring from the specified array. It returns an int[2] where int[0] represents the substring index and int[1] represents position where substring was found. If noting found, int[0] will be equals to -1.

Parameters:
s - source string
arr - string array
fromIndex - starting position
Returns:
int[2]

equals

public static boolean equals(java.lang.String[] as,
                             java.lang.String[] as1)
Compares two string arrays.

Parameters:
as - first string array
as1 - second string array
Returns:
true if all array elements matches

equalsIgnoreCase

public static boolean equalsIgnoreCase(java.lang.String[] as,
                                       java.lang.String[] as1)
Compares two string arrays.

Parameters:
as - first string array
as1 - second string array
Returns:
true if all array elements matches

replace

public static java.lang.String replace(java.lang.String s,
                                       java.lang.String[] sub,
                                       java.lang.String[] with)
Replaces many substring at once. Order of string array is important.

Parameters:
s - source string
sub - substrings array
with - replace with array
Returns:
string with all occurrences of substrings replaced

replaceIgnoreCase

public static java.lang.String replaceIgnoreCase(java.lang.String s,
                                                 java.lang.String[] sub,
                                                 java.lang.String[] with)
Replaces many substring at once. Order of string array is important.

Parameters:
s - source string
sub - substrings array
with - replace with array
Returns:
string with all occurrences of substrings replaced

equalsOne

public static int equalsOne(java.lang.String src,
                            java.lang.String[] dest)
Compares string with at least one from the provided array. If at least one equal string is found, returns its index. Otherwise, -1 is returned.


equalsOneIgnoreCase

public static int equalsOneIgnoreCase(java.lang.String src,
                                      java.lang.String[] dest)
Compares string with at least one from the provided array, ignoring case. If at least one equal string is found, it returns its index. Otherwise, -1 is returned.


startsWithOne

public static int startsWithOne(java.lang.String src,
                                java.lang.String[] dest)
Checks if string starts with at least one string from the provided array. If at least one string is matched, it returns its index. Otherwise, -1 is returned.


startsWithOneIgnoreCase

public static int startsWithOneIgnoreCase(java.lang.String src,
                                          java.lang.String[] dest)
Checks if string starts with at least one string from the provided array. If at least one string is matched, it returns its index. Otherwise, -1 is returned.


endsWithOne

public static int endsWithOne(java.lang.String src,
                              java.lang.String[] dest)
Checks if string ends with at least one string from the provided array. If at least one string is matched, it returns its index. Otherwise, -1 is returned.


endsWithOneIgnoreCase

public static int endsWithOneIgnoreCase(java.lang.String src,
                                        java.lang.String[] dest)
Checks if string ends with at least one string from the provided array. If at least one string is matched, it returns its index. Otherwise, -1 is returned.


indexOfChars

public static int indexOfChars(java.lang.String string,
                               java.lang.String chars)

indexOfChars

public static int indexOfChars(java.lang.String string,
                               java.lang.String chars,
                               int startindex)
Returns the very first index of any char from provided string, starting from specified index offset. Returns index of founded char, or -1 if nothing found.


indexOfChars

public static int indexOfChars(java.lang.String string,
                               char[] chars)

indexOfChars

public static int indexOfChars(java.lang.String string,
                               char[] chars,
                               int startindex)
Returns the very first index of any char from provided string, starting from specified index offset. Returns index of founded char, or -1 if nothing found.


trim

public static void trim(java.lang.String[] strings)
Trims array of strings. Null elements of the array are ignored.


trimNonEmpty

public static void trimNonEmpty(java.lang.String[] strings)
Trims array of strings where empty strings are nulled. Null elements of the array are ignored.

See Also:
trimNonEmpty(String)

trimNonEmpty

public static java.lang.String trimNonEmpty(java.lang.String string)
Trims string where empty strings are returned as a null.


indexOfRegion

public static int[] indexOfRegion(java.lang.String string,
                                  java.lang.String leftBoundary,
                                  java.lang.String rightBoundary)
See Also:
indexOfRegion(String, String, String, int)

indexOfRegion

public static int[] indexOfRegion(java.lang.String string,
                                  java.lang.String leftBoundary,
                                  java.lang.String rightBoundary,
                                  int offset)
Returns indexes of the first region without escaping character.

See Also:
indexOfRegion(String, String, String, char, int)

indexOfRegion

public static int[] indexOfRegion(java.lang.String string,
                                  java.lang.String leftBoundary,
                                  java.lang.String rightBoundary,
                                  char escape)
See Also:
indexOfRegion(String, String, String, char, int)

indexOfRegion

public static int[] indexOfRegion(java.lang.String string,
                                  java.lang.String leftBoundary,
                                  java.lang.String rightBoundary,
                                  char escape,
                                  int offset)
Returns indexes of the first string region. Region is defined by its left and right boundary. Return value is an array of the following indexes:

Escape character may be used to prefix boundaries so they can be ignored. If region is not founded, null is returned.


convertCharset

public static java.lang.String convertCharset(java.lang.String source,
                                              java.lang.String srcCharsetName,
                                              java.lang.String newCharsetName)
                                       throws java.io.UnsupportedEncodingException
Converts string charsets.

Throws:
java.io.UnsupportedEncodingException


Copyright ©2008 Jodd Team