1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-15 05:45:05 -05:00
This commit is contained in:
Reinhard Pointner 2016-08-04 20:29:33 +08:00
parent a34882b4bf
commit 4e7f45f244

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;