A Solution for IsLowercase()

I started writing my check for IsLowercase() before the hint about islower(), and ended up going a different route. Seems to work, or at least it doesn’t mind spaces, and \0.

bool FBullCowGame::IsLowerCase(FString Word) const
{
	for (auto Letter : Word) 
	{
		if (tolower(Letter) != Letter) {
			return false;
		}
	}
	return true;
}

My solution. :sunny:
bool FBullCowGame::Is_Lowercase(FString Guess) const
{
if (Guess.length() == 0)
{
return false;
}

for (auto Letter : Guess)
{
	if (!islower(Letter))
	{
		return false;
	}
}

return true;

}

Privacy & Terms