1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Fixed capitalization algorithm

This commit is contained in:
Martin Tůma 2024-04-16 08:52:54 +02:00
parent 5f3203d638
commit 99f620f101

View File

@ -54,11 +54,14 @@ static QString capitalized(const QString &str)
ret.resize(str.size()); ret.resize(str.size());
for (int i = 0; i < str.size(); i++) { if (!str.isEmpty())
ret[0] = str.at(0);
for (int i = 1; i < str.size(); i++) {
QChar last(str.at(i-1)); QChar last(str.at(i-1));
QChar current(str.at(i)); QChar current(str.at(i));
if (i && !(last.isSpace() || last == '(')) if (!(last.isSpace() || last == '('))
ret[i] = current.toLower(); ret[i] = current.toLower();
else else
ret[i] = current; ret[i] = current;