IsLowercase() function

bool FBullCowGame::IsLowercase(FString Word) const {
	// For all letters of the word
	for (auto Letter : Word) {
		// If the letter is not lowercase...
		if (Letter >= 'A' && Letter <= 'Z') {
			return false;
		}		
	}
	return true;
}

Here is my IsLowercase() function - it works for all the inputs that were suggested, although it doesn’t make use of islower()…

Nice, just note that your function will return true for a string containing numbers and special characters besides lowercase letters. If that is intended, it is ok, though.

Good point, I hadn’t thought about that! I believe I have another function which checks for numbers, but special characters might slip through with my current setup - probably worth changing to use islower()

Privacy & Terms