0
votes
    if(keccak256(products[i].category) != keccak256(category))
      eq=false;

Invalid type for argument in function call. Invalid implicit conversion from string storage ref to bytes memory requested. This function requires a single bytes argument

1

1 Answers

0
votes

You can compare strings using this

function compareStrings (string memory a, string memory b) public view returns (bool) {
    return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));
}

Refer this for original answer.