IsIsogram

I got the definition wrong of what an Isogram is, edited to reflect:

bool UBullCowCartridge::IsIsogram(const FString& Word)
{
    if (Word.Len() <= 1) { return false; } //1 character or less can't be an isogram

    for (size_t index = 0; index < (Word.Len() - 1); ++index)
    {
        for (size_t comparison = index + 1; comparison < (Word.Len() - 1); ++comparison)
        {
            if (Word[index] == Word[comparison]) { return false; }
        }
    }

    return true;
}
1 Like

Nice IsIsogram function!

Privacy & Terms