This commit is contained in:
Reinhard Pointner 2016-08-04 20:29:33 +08:00
parent a34882b4bf
commit 4e7f45f244
1 changed files with 3 additions and 2 deletions

View File

@ -54,10 +54,11 @@ public class ExpressionFormatFunctions {
} }
public static Map<String, String> csv(String path) throws IOException { public static Map<String, String> csv(String path) throws IOException {
Pattern[] delimiter = { TAB, SEMICOLON };
Map<String, String> map = new LinkedHashMap<String, String>(); Map<String, String> map = new LinkedHashMap<String, String>();
streamLines(new File(path)).forEach(line -> { streamLines(new File(path)).forEach(line -> {
for (Pattern delim : new Pattern[] { TAB, SEMICOLON }) { for (Pattern d : delimiter) {
String[] field = delim.split(line, 2); String[] field = d.split(line, 2);
if (field.length >= 2) { if (field.length >= 2) {
map.put(field[0].trim(), field[1].trim()); map.put(field[0].trim(), field[1].trim());
break; break;