Commit e4360f47 authored by Matija Obreza's avatar Matija Obreza

Support split and regexp for all types using toString()

parent 77d32386
......@@ -131,23 +131,27 @@ public class RowConverter {
private static Object convertCellValue(Object value, boolean splitString, String separator, String pattern, String groupPattern) {
if (value != null) {
if (value instanceof String) {
String stringValue = ((String) value);
if (splitString) {
String stringValue = value.toString();
if (StringUtils.isBlank(stringValue)) {
return null;
}
if (splitString) {
String[] split = stringValue.split(separator);
for (int i = split.length - 1; i >= 0; i--) {
if (pattern != null) {
split[i] = valueFromPattern(split[i].trim(), pattern, groupPattern);
} else {
split[i] = split[i].trim();
}
String[] split = stringValue.split(separator);
for (int i = split.length - 1; i >= 0; i--) {
if (pattern != null) {
split[i] = valueFromPattern(split[i].trim(), pattern, groupPattern);
} else {
split[i] = split[i].trim();
}
return split;
}
return split;
}
if (StringUtils.isNotBlank(pattern)) {
String stringValue = value.toString();
if (StringUtils.isBlank(stringValue)) {
return null;
}
String patVal = valueFromPattern(stringValue.trim(), pattern, groupPattern);
if (StringUtils.isBlank(patVal)) {
return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment