I am newbie to solidity. I am trying to split a string at into different based on '?' appearing. For example
test/?stat=true -----> test/ and stat=true
test/?stat=true?newstat=false -----> test/ stat=true and newstat=false
how this can be done. I tried using string utils library but it gives me a bunch of errors
https://github.com/Arachnid/solidity-stringutils
I tried splitting like this as an example (sample code)
// SPDX-License-Identifier: MIT
import "github.com/Arachnid/solidity-stringutils/src/strings.sol";
contract Contract {
using strings for *;
var s = "foo bar baz".toSlice();
var foo = s.split(" ".toSlice());
}
I am getting the following error
from solidity:
ParserError: Function, variable, struct or modifier declaration expected.
--> trial.sol:7:5:
|
7 | var s = "foo bar baz".toSlice();
| ^^^