evmtools
HomeContracts UIZK NetworksStorage ReaderLearnSupport
Twitter
Go-To Tool Kit For Web3 Developers

Debug Faster


Compare Strings In Solidity

Best way to compare strings in solidity.


function compareLengthAndHash(string a, string b) internal returns (bool) {
    if(bytes(a).length != bytes(b).length) {
        return false;
    } else {
        return keccak256(a) == keccak256(b);
    }
}

Previous

How to call private functions in solidity?

Next

Function Selectors in Solidity

evmtools
  • Follow


evmtools.xyz

Tools for zero knowledge proofs, smart contracts, ethereum (& L2), web3 apps and cryptography.