I have the following line of code in Solidity:
var res = result.toSlice();
This slices a string. When trying to compile in Truffle, I am getting var is deprecated error message. I am confused a bit, since I don't know what is the type of the variable here? Neither of my known types work here.
UPD: When changing the variable into, say, string storage
, I am getting Type struct strings.slice memory is not implicitly convertible to expected type string storage pointer.
The .toSlice()
function of the strings
library:
/*
* @dev Returns a slice containing the entire string.
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
function toSlice(string self) internal returns (slice) {
uint ptr;
assembly {
ptr := add(self, 0x20)
}
return slice(bytes(self).length, ptr);
}
slice, apparently, is a struct:
struct slice {
uint _len;
uint _ptr;
}