ListParseUtil provides a set of static helpers for parsing and manipulating with comma separated lists in strings.
Type Params | Return Type | Name and description |
---|---|---|
|
static List<Long> |
parseLongList(String orig) Parses a comma separated list of numbers in a given string. |
|
static List<String> |
parseStringList(String orig) Parses a comma separated list of strings in a given String instance into an actual list of strings. |
|
static String |
sanitizeNameListForSql(String orig) Accepts a comma separated list as a string, and converts it for safe use as a single-quoted comma separated list. |
Parses a comma separated list of numbers in a given string.
orig
- a comma separated list of numbersParses a comma separated list of strings in a given String instance into an actual list of strings.
orig
- a comma separated list of stringsAccepts a comma separated list as a string, and converts it for safe use as a single-quoted comma separated list. The intent is to convert anything that might be typed into a parameter table by a user into something that we can use in a select. It corrects most of the ham-handedness we have seen in the past. This method is not compatible with values that are supposed to begin or end in a space. It assumes all such things are unintentional errors and removes them. However spaces in the middle of an individual value are preserved.
orig
- a string with a comma separated list