Package gov.usgs.util

Class StringUtils

java.lang.Object
gov.usgs.util.StringUtils

public class StringUtils extends Object
String parsing and utility functions.
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • encodeAsUtf8

      public static String encodeAsUtf8(String value) throws UnsupportedEncodingException
      Parameters:
      value - value to encode
      Returns:
      Utf8 encoded string
      Throws:
      UnsupportedEncodingException - if character encoding is not supported
    • getDouble

      public static Double getDouble(String value)
      No Exception Double parsing method.
      Parameters:
      value - string to get double from
      Returns:
      null on error, otherwise Double value.
    • getFloat

      public static Float getFloat(String value)
      No Exception Float parsing method.
      Parameters:
      value - string to get float from
      Returns:
      null on error, otherwise Float value.
    • getInteger

      public static Integer getInteger(String value)
      No Exception Integer parsing method.
      Parameters:
      value - string to get integer from
      Returns:
      null on error, otherwise Integer value.
    • getLong

      public static Long getLong(String value)
      No Exception Long parsing method.
      Parameters:
      value - string to get long from
      Returns:
      null on error, otherwise Integer value.
    • join

      public static String join(List<Object> list, String delimiter)
      Join objects in a list using the specified delimiter. The objects toString method is used to get a string value.
      Parameters:
      delimiter - string to insert between list items.
      list - items to join.
      Returns:
      string containing delimiter delimited list items.
    • split

      public static List<String> split(String toSplit, String delimiter)
      Split a string into a list of strings using the specified delimiter. The intrinsic String.split method is used and elements of the returned String array (if any) are added to a list.
      Parameters:
      toSplit - string to split.
      delimiter - string used to separate items in toSplit
      Returns:
      a list containing items.