Hi
I'm trying to split a string like this: hellow-world-how-are-you-doing with the code below.
var s = c.toSlice();
var delim = "-".toSlice();
var parts = new string[](s.count(delim) + 1);
string[] memory arr = new string[](parts.length);
for (uint i = 0; i < parts.length; i++) {
arr[i] = (s.split(delim).toString());
}
But when running a test with truffle there is always an unwanted extra empty string in the result array. This is weird but it's working just fine in remix-ide.
Hi I'm trying to split a string like this:
hellow-world-how-are-you-doing
with the code below.But when running a test with truffle there is always an unwanted extra empty string in the result array. This is weird but it's working just fine in remix-ide.