diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2022-11-01 16:00:04 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-11-11 16:32:53 +0100 |
commit | 80aba027af3ff41f344bd5a03245900899a1f22a (patch) | |
tree | d072157df2774d17a21022e3bb0a276f9735fef4 /src/corelib/text/qlocale.cpp | |
parent | 83594367514b4c8871e58171e699abba66bf225f (diff) |
QLocaleData::numberToCLocale(): make discarding of grouping overt
If grouping isn't allowed, return early on hitting any.
Make the elision of grouping from the converted string easier to see.
Change-Id: I452d1e2b64612cd3ce534907a4b9aac652669ba5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qlocale.cpp')
-rw-r--r-- | src/corelib/text/qlocale.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 7dea0e05c7..0755cd8354 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -3969,10 +3969,6 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o last_separator_idx = idx; digitsInGroup = 0; - - // don't add the group separator - idx += in.size(); - continue; } else if (out == '.' || idx == exponent_idx) { // Were there enough digits since the last separator? if (last_separator_idx != -1 && digitsInGroup != m_grouping_least) @@ -3985,9 +3981,12 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o } else if (out >= '0' && out <= '9') { digitsInGroup++; } + } else if (out == ',') { + return false; } - result->append(out); + if (out != ',') // Leave group separators out of the result. + result->append(out); idx += in.size(); } |