Today I met two issues with split function
(1) When splitting string as pipeline , please use :
String key = "1|2|3||||";
String[] items = key.split("\\|")
(2) When spliting string with empty values and you don’t want to drop empty value. please use:
String key = "1|2|3||||";
String[] items = key.split("\\|", -1)
But if you want to remove empty values:
String key = "1|2|3||||";
String[] items = key.split("\\|", 0)
or
String key = "1|2|3||||";
String[] items = key.split("\\|")