Package au.csiro.pathling.utilities
Class Strings
java.lang.Object
au.csiro.pathling.utilities.Strings
Utility class containing some methods for string wrangling.
- Author:
- John Grimes
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T> parseCsvList(String csvList, Function<String, T> converter) Leniently parses a list of coma separated values.static StringGenerates a short random string for use as a column alias.static StringunSingleQuote(String value) Removes surrounding single quotes from a string.static StringunTickQuote(String value) Removes surrounding tick quotes from a string.
-
Method Details
-
unSingleQuote
Removes surrounding single quotes from a string.- Parameters:
value- a String surrounded by single quotes- Returns:
- the unquoted String
-
unTickQuote
Removes surrounding tick quotes from a string.- Parameters:
value- a String surrounded by tick quotes- Returns:
- the unquoted String
-
randomAlias
Generates a short random string for use as a column alias.- Returns:
- a short, random String for use as a column alias
-
parseCsvList
@Nonnull public static <T> List<T> parseCsvList(@Nonnull String csvList, @Nonnull Function<String, T> converter) Leniently parses a list of coma separated values. Trims the strings and filters out empty values.- Type Parameters:
T- the type of elements to produce.- Parameters:
csvList- a coma separated list of equivalence codesconverter- a function that converts single value string to the desired type T- Returns:
- the list of converted values of type T.
-