summaryrefslogtreecommitdiff
path: root/unotools/source/i18n
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-03 11:51:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-04 10:01:33 +0200
commitbf6b64d5963002d52c3ed2093b064896a4316d0e (patch)
treef38cc694ab887f63e4cf41eaaf4f57d61cba31fd /unotools/source/i18n
parent8342e4a5c7bd436f869e6c1c23d248556087ebdf (diff)
use more string_view in unotools
Change-Id: Id10d68f2eb016671be6842dfaa82909207b0708d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133754 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools/source/i18n')
-rw-r--r--unotools/source/i18n/charclass.cxx16
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx8
2 files changed, 12 insertions, 12 deletions
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
index e11ffb6e27d0..05bc2dd6bf48 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -58,12 +58,12 @@ const css::lang::Locale& CharClass::getMyLocale() const
}
// static
-bool CharClass::isAsciiNumeric( const OUString& rStr )
+bool CharClass::isAsciiNumeric( std::u16string_view rStr )
{
- if ( rStr.isEmpty() )
+ if ( rStr.empty() )
return false;
- const sal_Unicode* p = rStr.getStr();
- const sal_Unicode* const pStop = p + rStr.getLength();
+ const sal_Unicode* p = rStr.data();
+ const sal_Unicode* const pStop = p + rStr.size();
do
{
@@ -76,12 +76,12 @@ bool CharClass::isAsciiNumeric( const OUString& rStr )
}
// static
-bool CharClass::isAsciiAlpha( const OUString& rStr )
+bool CharClass::isAsciiAlpha( std::u16string_view rStr )
{
- if ( rStr.isEmpty() )
+ if ( rStr.empty() )
return false;
- const sal_Unicode* p = rStr.getStr();
- const sal_Unicode* const pStop = p + rStr.getLength();
+ const sal_Unicode* p = rStr.data();
+ const sal_Unicode* const pStop = p + rStr.size();
do
{
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 24b19371a5a9..469457986f56 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -460,13 +460,13 @@ sal_uInt16 LocaleDataWrapper::getCurrDigits() const
return nCurrDigits;
}
-void LocaleDataWrapper::scanCurrFormatImpl( const OUString& rCode,
+void LocaleDataWrapper::scanCurrFormatImpl( std::u16string_view rCode,
sal_Int32 nStart, sal_Int32& nSign, sal_Int32& nPar,
sal_Int32& nNum, sal_Int32& nBlank, sal_Int32& nSym ) const
{
nSign = nPar = nNum = nBlank = nSym = -1;
- const sal_Unicode* const pStr = rCode.getStr();
- const sal_Unicode* const pStop = pStr + rCode.getLength();
+ const sal_Unicode* const pStr = rCode.data();
+ const sal_Unicode* const pStop = pStr + rCode.size();
const sal_Unicode* p = pStr + nStart;
int nInSection = 0;
bool bQuote = false;
@@ -523,7 +523,7 @@ void LocaleDataWrapper::scanCurrFormatImpl( const OUString& rCode,
p = pStop;
break;
default:
- if (!nInSection && nSym == -1 && rCode.match(aCurrSymbol, static_cast<sal_Int32>(p - pStr)))
+ if (!nInSection && nSym == -1 && o3tl::starts_with(rCode.substr(static_cast<sal_Int32>(p - pStr)), aCurrSymbol))
{ // currency symbol not surrounded by [$...]
nSym = p - pStr;
if (nBlank == -1 && pStr < p && *(p-1) == ' ')