Package Common

Class ListConverter

java.lang.Object
Common.ListConverter

public class ListConverter extends Object
The ListConverter class provides utility methods for converting between strings and lists of strings, as well as replacing specific characters within those strings.
  • Constructor Details

    • ListConverter

      public ListConverter()
  • Method Details

    • replaceWithComma

      public static String replaceWithComma(String input)
      Replaces all occurrences of '~' with ',' in the input string.
      Parameters:
      input - the string in which to replace characters
      Returns:
      the modified string with '~' replaced by ',' or null if input is null
    • replaceWithCurly

      public static String replaceWithCurly(String input)
      Replaces all occurrences of ',' with '~' in the input string.
      Parameters:
      input - the string in which to replace characters
      Returns:
      the modified string with ',' replaced by '~' or null if input is null
    • replaceWithComma

      public static List<String> replaceWithComma(List<String> inputs)
      Replaces all occurrences of '~' with ',' in a list of strings.
      Parameters:
      inputs - the list of strings in which to replace characters
      Returns:
      a new list with all '~' replaced by ',' in each string
    • replaceWithCurly

      public static List<String> replaceWithCurly(List<String> inputs)
      Replaces all occurrences of ',' with '~' in a list of strings.
      Parameters:
      inputs - the list of strings in which to replace characters
      Returns:
      a new list with all ',' replaced by '~' in each string
    • stringToList

      public static List<String> stringToList(String input)
      Converts a string to a list of strings by splitting it using ';'.
      Parameters:
      input - the string to be converted into a list
      Returns:
      a list of strings obtained by splitting the input, or an empty list if input is null or empty
    • listToString

      public static String listToString(List<String> inputs)
      Converts a list of strings into a single string joined by ';'.
      Parameters:
      inputs - the list of strings to be joined into a single string
      Returns:
      a single string containing all elements joined by ';', or an empty string if the list is null or empty