|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.ephyra.util.StringUtils
public class StringUtils
A collection of utilities for string processing.
| Field Summary | |
|---|---|
private static float |
INTERSECT_THRESH
Fraction of words that must occur in both strings for equalsIntersect() to be true. |
| Constructor Summary | |
|---|---|
StringUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
concat(java.lang.String[] ss,
java.lang.String delim)
Concatenates an array of strings, using the given delimiter. |
static java.lang.String |
concatWithSpaces(java.lang.String[] ss)
Concatenates an array of strings, using whitespaces as delimiters. |
static java.lang.String |
concatWithTabs(java.lang.String[] ss)
Concatenates an array of strings, using tabs as delimiters. |
static boolean |
equalsCommon(java.lang.String s1,
java.lang.String s2)
Compares two strings. |
static boolean |
equalsCommonNorm(java.lang.String s1,
java.lang.String s2)
Compares the normalizations of the two strings, using the same criterion as the equalsCommon() method. |
static boolean |
equalsCommonProp(java.lang.String s1,
java.lang.String s2)
Compares two strings, using the same criterion as the equalsCommonNorm() method, but considers only words starting with a capital letter (proper nouns) |
static boolean |
equalsIntersect(java.lang.String s1,
java.lang.String s2)
Compares two strings. |
static boolean |
equalsIntersectNorm(java.lang.String s1,
java.lang.String s2)
Compares the normalizations of the two strings, using the equalsIntersect() method. |
static boolean |
equalsNorm(java.lang.String s1,
java.lang.String s2)
Compares the normalizations of the two strings, using the standard String.equals() method. |
static boolean |
equalsSubset(java.lang.String s1,
java.lang.String s2)
Compares two strings. |
static boolean |
equalsSubsetNorm(java.lang.String s1,
java.lang.String s2)
Compares the normalizations of the two strings, using the equalsSubset() method. |
private static boolean |
isSubset(java.lang.String[] tokens1,
java.lang.String[] tokens2)
Checks if the first array of tokens is a subset if the second array. |
static boolean |
isSubset(java.lang.String s1,
java.lang.String s2)
Checks if the tokens in the first string form a subset of the tokens in the second string. |
static boolean |
isSubsetKeywords(java.lang.String s1,
java.lang.String s2)
Checks if the tokens in the first string form a subset of the tokens in the second string. |
static java.lang.String |
normalize(java.lang.String s)
Normalizes a string. |
static java.lang.String |
repeat(java.lang.String s,
int n)
Repeats string s n times. |
static java.lang.String |
replaceIgnoreCase(java.lang.String s,
java.lang.String s1,
java.lang.String s2)
Replaces all substrings of s that match s1 with
s2. |
static void |
sortByLength(java.lang.String[] ss)
Sorts an array of strings by their length in ascending order. |
static void |
sortByLengthDesc(java.lang.String[] ss)
Sorts an array of strings by their length in descending order. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final float INTERSECT_THRESH
equalsIntersect() to be true.
| Constructor Detail |
|---|
public StringUtils()
| Method Detail |
|---|
private static boolean isSubset(java.lang.String[] tokens1,
java.lang.String[] tokens2)
tokens1 - token array 1tokens2 - token array 2
public static boolean isSubset(java.lang.String s1,
java.lang.String s2)
s1 - string 1s2 - string 2
public static boolean isSubsetKeywords(java.lang.String s1,
java.lang.String s2)
s1 - string 1s2 - string 2
public static java.lang.String concat(java.lang.String[] ss,
java.lang.String delim)
ss - array of stringsdelim - delimiter
public static java.lang.String concatWithSpaces(java.lang.String[] ss)
ss - array of strings
public static java.lang.String concatWithTabs(java.lang.String[] ss)
ss - array of strings
public static java.lang.String repeat(java.lang.String s,
int n)
s n times.
s - a stringn - number of repetitionspublic static java.lang.String normalize(java.lang.String s)
s - the string
public static boolean equalsNorm(java.lang.String s1,
java.lang.String s2)
String.equals() method.
s1 - string 1s2 - string 2
public static boolean equalsSubset(java.lang.String s1,
java.lang.String s2)
s1 - string 1s2 - string 2
public static boolean equalsSubsetNorm(java.lang.String s1,
java.lang.String s2)
equalsSubset() method.
s1 - string 1s2 - string 2
public static boolean equalsIntersect(java.lang.String s1,
java.lang.String s2)
INTERSECT_FRAC.
s1 - string 1s2 - string 2
public static boolean equalsIntersectNorm(java.lang.String s1,
java.lang.String s2)
equalsIntersect() method.
s1 - string 1s2 - string 2
public static boolean equalsCommon(java.lang.String s1,
java.lang.String s2)
s1 - string 1s2 - string 2
public static boolean equalsCommonNorm(java.lang.String s1,
java.lang.String s2)
equalsCommon() method.
s1 - string 1s2 - string 2
public static boolean equalsCommonProp(java.lang.String s1,
java.lang.String s2)
equalsCommonNorm() method, but considers only words starting with a capital letter (proper nouns)
s1 - string 1s2 - string 2
public static java.lang.String replaceIgnoreCase(java.lang.String s,
java.lang.String s1,
java.lang.String s2)
s that match s1 with
s2. This method is similar to String.replace(),
but it ignores the case of s1.
s - the strings1 - the substring to be replaceds2 - the replacement for the substring
public static void sortByLength(java.lang.String[] ss)
Sorts an array of strings by their length in ascending order.
This sort is guaranteed to be stable: strings of equal length are not reordered.
ss - array of stringspublic static void sortByLengthDesc(java.lang.String[] ss)
Sorts an array of strings by their length in descending order.
This sort is guaranteed to be stable: strings of equal length are not reordered.
ss - array of strings
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||