X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7451fe7b69ad7f1eca88bee822c3d016bd8bc35a..77c8efc8c37da6d6a5e2e8022d21d1cd7d76371d:/src/common/numformatter.cpp diff --git a/src/common/numformatter.cpp b/src/common/numformatter.cpp index eb4583b520..0c3a6a7a1a 100644 --- a/src/common/numformatter.cpp +++ b/src/common/numformatter.cpp @@ -235,6 +235,10 @@ void wxNumberFormatter::AddThousandsSeparators(wxString& s) pos = s.length(); } + // End grouping at the beginning of the digits -- there could be at a sign + // before their start. + const size_t start = s.find_first_of("0123456789"); + // We currently group digits by 3 independently of the locale. This is not // the right thing to do and we should use lconv::grouping (under POSIX) // and GetLocaleInfo(LOCALE_SGROUPING) (under MSW) to get information about @@ -242,7 +246,7 @@ void wxNumberFormatter::AddThousandsSeparators(wxString& s) // wxLocale level first and then used here in the future (TODO). const size_t GROUP_LEN = 3; - while ( pos > GROUP_LEN ) + while ( pos > start + GROUP_LEN ) { pos -= GROUP_LEN; s.insert(pos, thousandsSep);