summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-03-13 12:11:04 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-03-13 13:05:41 +0000
commit2cb2e2b9c1d55bbbc639997ca30fd6b57a81bfb2 (patch)
tree63657503f9076375fb29eafb19dcab41b2528509 /svl
parentcd50669485ebea3c45d4c555ad90ff484e22f429 (diff)
Introduce OUStringBuffer::insert taking OUStringConcat
Avoids some (re)allocations, and aligns with already existing append Change-Id: I536ba50f56fc560c0f6e8c0a8b65bd4248896a8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148777 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx19
1 files changed, 7 insertions, 12 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index effb34ad996f..549194736e69 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -709,7 +709,7 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer& rString,
if ( nNumeralID >= 0x02 && nNumeralID <= 0x13 )
nNatNum = 1;
if ( nNatNum )
- rString.insert( nPos, Concat2View("[NatNum"+OUString::number(nNatNum)+"]"));
+ rString.insert(nPos, "[NatNum" + OUString::number(nNatNum) + "]");
return sCalendar;
}
@@ -1101,11 +1101,8 @@ SvNumberformat::SvNumberformat(OUString& rString,
sBuff.remove(nPosOld, nPos - nPosOld);
if (!sStr.isEmpty())
{
- sBuff.insert(nPosOld, sStr);
- nPos = nPosOld + sStr.getLength();
- sBuff.insert(nPos, "]");
- sBuff.insert(nPosOld, "[");
- nPos += 2;
+ sBuff.insert(nPosOld, "[" + sStr + "]");
+ nPos = nPosOld + sStr.getLength() + 2;
nPosOld = nPos; // position before string
}
else
@@ -5210,18 +5207,16 @@ static void lcl_insertLCID( OUStringBuffer& rFormatStr, sal_uInt32 nLCID, sal_In
// No format code, no locale.
return;
- OUStringBuffer aLCIDString = OUString::number( nLCID , 16 ).toAsciiUpperCase();
+ auto aLCIDString = OUString::number( nLCID , 16 ).toAsciiUpperCase();
// Search for only last DBNum which is the last element before insertion position
if ( bDBNumInserted && nPosInsertLCID >= 8
- && aLCIDString.getLength() > 4
- && rFormatStr.indexOf( "[DBNum", nPosInsertLCID-8) == nPosInsertLCID-8 )
+ && aLCIDString.length > 4
+ && OUString::unacquired(rFormatStr).match( "[DBNum", nPosInsertLCID-8) )
{ // remove DBNumX code if long LCID
nPosInsertLCID -= 8;
rFormatStr.remove( nPosInsertLCID, 8 );
}
- aLCIDString.insert( 0, "[$-" );
- aLCIDString.append( "]" );
- rFormatStr.insert( nPosInsertLCID, aLCIDString );
+ rFormatStr.insert( nPosInsertLCID, "[$-" + aLCIDString + "]" );
}
/** Increment nAlphabetID for CJK numerals