I just finished testing my IsIsogram() method and here is what I’ve got:
bool FBullCowGame::IsIsogram(FString Word) const
{
if (Word.length() <= 1) { return true; } //consider short words to be isograms
TMap <char, bool> LetterSeen; //create map
for (auto Letter : Word) //Loop through all the letters of the word
{
Letter = tolower(Letter); //make case for caps
if (!LetterSeen[Letter]) //use map to check for whether a letter has already been used
{
LetterSeen[Letter] = true;
}
else
{
return false;
}
}
return true;
}
All my tests for it thus far have shown it to be working fine.
I tested “\0”, “Aa”, “a”, “”, etc.