Today, submitter Adam shows us how thoughtless language assumptions made by programmers are also hilarious language assumptions:

"So we're querying a database for data matching *title* but then need to try again with plural/singular if we didn't get anything. Removing the trailing S is bad, but what really caught my eye was how we make a word plural. Never mind any English rules or if the word is actually Greek, Chinese, or Klingon."


if ((locs == NULL || locs->Length() == 0) && (title->EndsWith(@"s") || title->EndsWith(@"S")))
{
    title->RemoveCharAt(title->Length()-1);
    locs = data->GetLocationsForWord(title);
}
else if ((locs == NULL || locs->Length() == 0) && title->Length() > 0)
{
    WCHAR c = title->CharAt(title->Length()-1);
    if (c >= 'A' && c <= 'Z')
    {
        title->Append(@"S");
    }
    else
    {
        title->Append(@"s");
    }
    locs = data->GetLocationsForWord(title);
}

Untils nexts times: ευχαριστώs &s 再见s, Hochs!

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!