X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Fparsers%2FVcard21Parser.java;h=6d8b2babc14ca9de578ab4d4b15157e628a7ecad;hp=f2fd07c5aef8a750bce8db49074113bfadb1ce72;hb=adf9c44949504512002cff293641225b31ec568a;hpb=e741845793d462cdb06f27423fa761bb5b8ebd6b diff --git a/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java b/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java index f2fd07c..6d8b2ba 100644 --- a/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java +++ b/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java @@ -64,8 +64,9 @@ public class Vcard21Parser { String group = ""; if (line.contains(":")) { - String rest = line.split(":")[0]; - value = line.substring(rest.length() + 1); + int colIndex = line.indexOf(':'); + String rest = line.substring(0, colIndex); + value = line.substring(colIndex + 1); if (rest.contains(";")) { String tab[] = rest.split(";"); @@ -73,9 +74,11 @@ public class Vcard21Parser { for (int i = 1; i < tab.length; i++) { if (tab[i].contains("=")) { - String tname = tab[i].split("=")[0]; - String tvalue = tab[i].substring(tname - .length() + 1); + int equIndex = tab[i].indexOf('='); + String tname = tab[i] + .substring(0, equIndex); + String tvalue = tab[i] + .substring(equIndex + 1); types.add(new TypeInfo(tname, tvalue)); } else { types.add(new TypeInfo(tab[i], "")); @@ -89,8 +92,9 @@ public class Vcard21Parser { } if (name.contains(".")) { - group = name.split("\\.")[0]; - name = name.substring(group.length() + 1); + int dotIndex = name.indexOf('.'); + group = name.substring(0, dotIndex); + name = name.substring(dotIndex + 1); } datas.add(new Data(types, name, value, group));