tag editor: fix CapitalizeFirstLetters

master
Andrzej Rybczak 14 years ago
parent 8fb88b7181
commit 1eecc0aa0b
  1. 16
      src/tag_editor.cpp

@ -1103,17 +1103,15 @@ namespace {//
std::string CapitalizeFirstLetters(const std::string &s) std::string CapitalizeFirstLetters(const std::string &s)
{ {
if (s.empty()) std::wstring ws = ToWString(s);
return ""; wchar_t prev = 0;
std::string result = s; for (auto it = ws.begin(); it != ws.end(); ++it)
if (!isspace(result[0]))
result[0] = toupper(result[0]);
for (std::string::iterator it = result.begin()+1; it != result.end(); ++it)
{ {
if (!isspace(*it) && isspace(*(it-1)) && *(it-1) != '\'') if (!iswalpha(prev) && prev != L'\'')
*it = toupper(*it); *it = towupper(*it);
prev = *it;
} }
return result; return ToString(ws);
} }
void CapitalizeFirstLetters(MPD::MutableSong &s) void CapitalizeFirstLetters(MPD::MutableSong &s)

Loading…
Cancel
Save