summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-01-27 15:06:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2021-01-27 17:16:20 +0100
commitfad5b7b9cf936bf6df49e2ac28977f350db24253 (patch)
treea2a014ed98200e2e9dbc9101e1bae33e5bce91fe /i18npool
parent02bb41dd5197503d0d8b7d8be0a8cd220c0d1c85 (diff)
Use std::u16string_view instead of OUString in one place
...due to which an upcoming loplugin:stringliteralvar improvement would otherwise have suggested to turn the MinusChar array into an OUStringLiteral, but which would have lead to awkward code elsewhere. (And the code is a bit more efficient this way now anyway, of course. The remaining OUString numberChar, multiplierChar, decimalChar, separatorChar; might benefit from a similar change, but they didn't interfere with the loplugin:stringliteralvar improvement, so are left alone at least for now.) Change-Id: I41e3ef987450cbd29d3663a9aeefda336d798170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110019 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index fd487c7de0ea..66a5655deed7 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -335,11 +335,11 @@ OUString NativeToAscii(const OUString& inStr,
sal_Int32 count = 0, index;
sal_Int32 i;
- OUString numberChar, multiplierChar, decimalChar, minusChar, separatorChar;
+ OUString numberChar, multiplierChar, decimalChar, separatorChar;
numberChar = OUString(NumberChar[0], 10*NumberChar_Count);
multiplierChar = OUString(MultiplierChar_7_CJK[0], ExponentCount_7_CJK*Multiplier_Count);
decimalChar = OUString(DecimalChar, NumberChar_Count);
- minusChar = OUString(MinusChar, NumberChar_Count);
+ std::u16string_view const minusChar(MinusChar, NumberChar_Count);
separatorChar = OUString(
reinterpret_cast<sal_Unicode *>(SeparatorChar), NumberChar_Count);
@@ -369,7 +369,7 @@ OUString NativeToAscii(const OUString& inStr,
// Only when decimal point is followed by numbers,
// it will be convert to ASCII decimal point
newStr[count] = DecimalChar[NumberChar_HalfWidth];
- else if (minusChar.indexOf(str[i]) >= 0 &&
+ else if (minusChar.find(str[i]) != std::u16string_view::npos &&
(i < nCount-1 && (numberChar.indexOf(str[i+1]) >= 0 ||
multiplierChar.indexOf(str[i+1]) >= 0)))
// Only when minus is followed by numbers,