Arachnid / solidity-stringutils

Basic string utilities for Solidity
Apache License 2.0
1.12k stars 369 forks source link

var alternative for "Splitting a string into an array"? #33

Closed DaniOwnerShip closed 5 years ago

DaniOwnerShip commented 5 years ago

I tried this function in remix and it works fine but when creating a contract it gives var keyword error is deprecated. Could you please give an example?

It is for :

var s = "www.google.com".toSlice();
var delim = ".".toSlice();
var parts = new string[](s.count(delim) + 1);
for(uint i = 0; i < parts.length; i++) {
    parts[i] = s.split(delim).toString();
}

but I can not replace var correctly

DaniOwnerShip commented 5 years ago

strings.slice memory