Skip to content
Reference > Methods

strSplitToMap(text,delim,associatorDelim)

Definition

Map strSplitToMap(String text, String delim, String associatorDelim)

Description

Splits line into a Map using the supplied delimiters and returns that map. The expected format of the input string is key=value,key=value,... where the equal and comma delimiters are configurable.

Parameter Definition

Name Type Description
text String The string to split
delim String delimiter, literal not a pattern
associatorDelim String delimiter between keys and values, literal not a pattern

Examples

Map r1 = strSplitToMap("apple=green cherry=red potato=brown"," ","="); // r1 == {apple=green, cherry=red, potato=brown}
Map r2 = strSplitToMap("apple==>green|cherry==>red|potato==>brown|apple==>red","|","==>"); // r2 == {apple=red, cherry=red, potato=brown}