Diff FBullAndCow::EDifficulty(std::string diff) const
{
if ((diff.length() > 1))
{
return Diff::Not_Number;
}
else if (!strchr(diff.c_str(), '3' || '4' || '5' || '6' || '7' || '8'))
{
return Diff::Not_Number;
}
return Diff::Ok;
}
Is it possible to find numerous characters in a string with strchr? I tried the method above, but it's not working. I suppose it's because strchr returns the occurrences of a character?
P.S:. I tried
if ((!strchr(diff.c_str(), '3')) || (!strchr(diff.c_str(), '4')))
to use it this way too, though it was probably stupid. I'm a total rookie... I did try to look for a way for hours, but since I couldn't find anything, I'm here.
EDIT: It needs to return the number it finds. Sorry for leaving this out.