public abstract class StringModifier extends Object
| Constructor and Description |
|---|
StringModifier() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areEqual(String s1,
String s2)
checks for equality between two potential strings
|
static String |
implode(Collection<?> col,
String delim) |
static String |
implode(String[] array,
String delim) |
static String |
implodeForDB(Collection<?> col,
String delim,
Database database) |
static String |
implodeForDB(Iterator<?> it,
String delim,
Database database) |
static <T,K> String |
implodeForDB(Iterator<Map.Entry<T,K>> it,
String keyValueDelim,
String pairDelim,
Database database,
boolean formatKey,
boolean formatValue)
Concatenates key value pairs of a Map.Entry iterator into a combined String,
separating each key from its value by a key-value delimeter
and each key-value pair by pair delimeter
while optionally applying the database.format function to each key/value
|
static String |
implodeForDB(Map<?,?> map,
String keyValueDelim,
String pairDelim,
Database database,
boolean formatKey,
boolean formatValue)
Concatenates key value pairs of a Map into a combined String,
separating each key from its value by a key-value delimeter
and each key-value pair by pair delimeter
while optionally applying the database.format function to each key/value
|
static <T> String |
implodeForDB(T[] col,
String delim,
Database database) |
static String |
implodeForDBAsConditions(Map<?,?> map,
Database database)
Concatenates key value pairs of a Map into a combined String
representing the pairs as independent column conditions for a database query,
applying the database.format function to each value
|
static String |
limitLength(String s,
int length)
limits the length of a String to the given size
ie applies s.substring(0,length) for given length iff
length<s.length()
|
static Set<String> |
lowercase(String... ar)
applies lowercase to all Strings in an array, returns them as a set
|
static void |
main(String[] argv)
Test method
|
static Set<String> |
toNGram(String original,
int n)
produces an n-gram set from the string
|
static Map<String,Double> |
toWeighedNGram(String original,
int n)
produces a weighed n-gram set from the string
|
public static String implode(Collection<?> col, String delim)
public static String implodeForDB(Collection<?> col, String delim, Database database)
public static String implodeForDBAsConditions(Map<?,?> map, Database database)
map - the Map to be implodeddatabase - the Database instance for which the pairs shall be formattedpublic static String implodeForDB(Map<?,?> map, String keyValueDelim, String pairDelim, Database database, boolean formatKey, boolean formatValue)
map - the Map to be implodedkeyValueDelim - delimeter inserted between each key and its valuepairDelim - delimeter inserted between key-value pairsdatabase - the Database instance for which the pairs shall be formattedformatKey - flag indicating whether to format the keys with database.formatformatValue - flag indicating whether to format the values with database.formatpublic static <T,K> String implodeForDB(Iterator<Map.Entry<T,K>> it, String keyValueDelim, String pairDelim, Database database, boolean formatKey, boolean formatValue)
it - the Map.Entry iteratorkeyValueDelim - delimeter inserted between each key and its valuepairDelim - delimeter inserted between key-value pairsdatabase - the Database instance for which the pairs shall be formattedformatKey - flag indicating whether to format the keys with database.formatformatValue - flag indicating whether to format the values with database.formatpublic static String limitLength(String s, int length)
public static Set<String> toNGram(String original, int n)
original - the String to be split into n-grams of size nn - size of the n-gramspublic static Map<String,Double> toWeighedNGram(String original, int n)
original - the String to be split into n-grams of size nn - size of the n-gramspublic static final Set<String> lowercase(String... ar)
public static final boolean areEqual(String s1, String s2)
Copyright © 2018. All rights reserved.