Class Strings

java.lang.Object
au.csiro.pathling.utilities.Strings

public abstract class Strings extends Object
Utility class containing some methods for string wrangling.
Author:
John Grimes
  • Constructor Details

    • Strings

      public Strings()
  • Method Details

    • parentheses

      @Nonnull public static String parentheses(@Nonnull String value)
      Parameters:
      value - a String value
      Returns:
      the string surrounded by parentheses
    • unSingleQuote

      @Nonnull public static String unSingleQuote(@Nonnull String value)
      Parameters:
      value - a String surrounded by single quotes
      Returns:
      the unquoted String
    • randomAlias

      @Nonnull public static String randomAlias()
      Returns:
      a short, random String for use as a column alias
    • looksLikeAlias

      public static boolean looksLikeAlias(@Nonnull CharSequence input)
      Parameters:
      input - a column name
      Returns:
      true if the column name looks like a randomly generated 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 codes
      converter - a function that converts single value string to the desired type T
      Returns:
      the list of converted values of type T.