* allow TSV and CSV formats

This commit is contained in:
Reinhard Pointner 2014-12-17 02:19:29 +00:00
parent eaff34998a
commit 400e5f5dcb
1 changed files with 6 additions and 3 deletions

View File

@ -91,9 +91,12 @@ public class ExpressionFormatFunctions {
public static Map<String, String> csv(String path) throws IOException {
Map<String, String> map = new LinkedHashMap<String, String>();
for (String line : Files.readAllLines(Paths.get(path), Charset.forName("UTF-8"))) {
String[] field = line.split(";", 2);
if (field.length >= 2) {
map.put(field[0], field[1]);
for (String delim : new String[] { "\t", ";" }) {
String[] field = line.split(delim, 2);
if (field.length >= 2) {
map.put(field[0], field[1]);
break;
}
}
}
return map;