improve "Capitalize First Letters" algorithm

This commit is contained in:
Andrzej Rybczak
2009-01-19 00:17:33 +01:00
parent f111b933a4
commit b93c04189e

View File

@@ -172,7 +172,7 @@ namespace
result[0] = toupper(result[0]); result[0] = toupper(result[0]);
for (string::iterator it = result.begin()+1; it != result.end(); it++) for (string::iterator it = result.begin()+1; it != result.end(); it++)
{ {
if (isalpha(*it) && *(it-1) == ' ') if (isalpha(*it) && !isalpha(*(it-1)))
*it = toupper(*it); *it = toupper(*it);
} }
return result; return result;