midify DtStringUtil splitIgnoreQuota
@@ -59,7 +59,13 @@ public class DtStringUtil {
boolean inSingleQuotes = false;
int bracketLeftNum = 0;
StringBuilder b = new StringBuilder();
- for (char c : str.toCharArray()) {
+ char[] chars = str.toCharArray();
+ int idx = 0;
+ for (char c : chars) {
+ char flag = 0;
+ if (idx > 0) {
+ flag = chars[idx - 1];
+ }
if(c == delimiter){
if (inQuotes) {
b.append(c);
@@ -71,10 +77,10 @@ public class DtStringUtil {
tokensList.add(b.toString());
b = new StringBuilder();
}
- }else if(c == '\"'){
+ }else if(c == '\"' && '\\'!=flag && !inSingleQuotes){
inQuotes = !inQuotes;
b.append(c);
- }else if(c == '\''){
+ }else if(c == '\'' && '\\'!=flag && !inQuotes){
inSingleQuotes = !inSingleQuotes;
b.append(c);
}else if(c == '('){
@@ -86,6 +92,7 @@ public class DtStringUtil {
}else{
b.append(c);
}
+ idx++;
}
tokensList.add(b.toString());
