Package Common
Class ListConverter
java.lang.Object
Common.ListConverter
The
ListConverter
class provides utility methods for converting
between strings and lists of strings, as well as replacing specific
characters within those strings.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
listToString
(List<String> inputs) Converts a list of strings into a single string joined by ';'.static String
replaceWithComma
(String input) Replaces all occurrences of '~' with ',' in the input string.replaceWithComma
(List<String> inputs) Replaces all occurrences of '~' with ',' in a list of strings.static String
replaceWithCurly
(String input) Replaces all occurrences of ',' with '~' in the input string.replaceWithCurly
(List<String> inputs) Replaces all occurrences of ',' with '~' in a list of strings.stringToList
(String input) Converts a string to a list of strings by splitting it using ';'.
-
Constructor Details
-
ListConverter
public ListConverter()
-
-
Method Details
-
replaceWithComma
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
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
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
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
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
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
-