Answers for "solidity check if array contains"

0

solidity check if array contains

// either use a mapping

mapping(address => uint8) myMap;

// write a for loop (try not to do this unless have to)
// try not to use less or equal to, use less instead 
// gas optimisation

for (uint256 i = 0; i < 1; i++) {
	if (searchList[i] == "toFindString") {
    // do whatever
    break;
    }
}
Posted by: Guest on April-23-2022

Code answers related to "solidity check if array contains"

Browse Popular Code Answers by Language