I am using a string utility library for Solidity with the aim of splitting a string on a specific delimiter. I followed the instructions from the library:

var s = someString.toSlice();
var foo = s.split("-".toSlice());


However, I'm getting an error with the logString(). The online Solidity IDE says

TypeError: Invalid type for argument in function call. Invalid implicit converstion from struct strings.slice memeory to string memory requested. 

How can I properly print out the sliced portion of the string?


I don't know how logString() is defined, but I imagine it takes a string argument. split() returns a slice, so you need to convert it to a string:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.