Using Solidity 0.4.17
, I have defined a simple library
at ./StringUtils.sol
library StringUtils {
function isEmptyString(string s) external pure returns (bool) {
return (keccak256(s) == keccak256(''));
}
}
Now I am trying to use it in a contract
at ./PastryChef.sol
import './StringUtils.sol';
contract PastryChef {
using StringUtils for StringUtils;
string name;
function PastryChef(string _name) public {
require(!StringUtils.isEmptyString(_name)); // name must not be empty
name = _name;
}
}
I get the error
TypeError: Member "isEmptyString" not found or not visible after argument-dependent lookup in type(library StringUtils)
require(!StringUtils.isEmptyString(_name)); // name must not be empty
^-----------------------^
What am I doing wrong?