public class StringUtil extends Object
| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
join(String separator,
Collection<String> list)
Converts a
Collection to a separator separated string |
static String |
join(String separator,
Collection<String> list,
String replacement)
Converts a
Collection to a separator separated string. |
static List<String> |
parseLine(String elements)
Parse CSV line
|
static String |
previewString(String string,
int limit)
Returns first limit characters of the string with last 3 letters replaced with ellipsis
Example: previewString("potatoe", 6) returns "pot..."
|
static String |
toIdentifier(String s)
Formats a string as identifier
Currently only converts to the lowercase and replace spaces
|
static String |
toTitle(String s)
Formats a string as title
Currently does nothing TBD
|
public static String toIdentifier(String s)
s - the string to convert to identifierpublic static String toTitle(String s)
s - the string to convert to a titlepublic static String join(String separator, Collection<String> list)
Collection to a separator separated stringseparator - list - public static String join(String separator, Collection<String> list, String replacement)
Collection to a separator separated string.
If the replacement parameter is not null, it is used to populate
the result string instead of list elements.separator - list - replacement - public static List<String> parseLine(String elements) throws IOException
elements - CSV lineIOExceptionCopyright © 2014. All rights reserved.