Skip to content
Snippets Groups Projects
Commit 2f2bacb6 authored by Adam Welc's avatar Adam Welc Committed by Mick Jordan
Browse files

Fixed a problem with strsplit function.

parent 6af7fa70
No related branches found
No related tags found
No related merge requests found
......@@ -809,6 +809,13 @@ public class GrepFunctions {
} else {
resultItem = splitIntl(data, currentSplit);
}
if (resultItem.getLength() == 0) {
if (fixed) {
resultItem = RDataFactory.createStringVector(data);
} else {
resultItem = RDataFactory.createStringVector(data.length());
}
}
}
result[i] = resultItem;
}
......
......@@ -110,5 +110,9 @@ public class TestBuiltin_strsplit extends TestBase {
assertEval("{ strsplit( c(\"helloh\", \"hi\"), c(\"h\",\"\")) }");
assertEval("{ strsplit(\"ahoj\", split=\"\") [[c(1,2)]] }");
assertEval("{ strsplit(\"a,h,o,j\", split=\",\") }");
assertEval("{ strsplit(\"abc\", \".\", fixed = TRUE, perl=FALSE) }");
assertEval("{ strsplit(\"abc\", \".\", fixed = TRUE, perl=TRUE) }");
assertEval("{ strsplit(\"abc\", \".\", fixed = FALSE, perl=FALSE) }");
assertEval("{ strsplit(\"abc\", \".\", fixed = FALSE, perl=TRUE) }");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment