diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-19 16:05:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-19 18:44:53 +0200 |
commit | 716a81042558143b400c502d1ba3e1ff1b3672e1 (patch) | |
tree | 13b4622a98b1042e00dd31fefada3a88394ddcca | |
parent | c3ea4a8025f1ba241a8ac5c53ac79fd274ec6b3a (diff) |
no need to use an OUStringBuffer here
can just return the substring we need
Change-Id: I9d605cb809f58fcf60c0ae2e29aaff17baa9faa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140177
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index ad98d645170f..0952effbbf86 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -155,20 +155,15 @@ rtl::Reference<ChartType> lcl_getFirstStockChartType( const rtl::Reference<::cha OUString lcl_getIndexStringAfterString( const OUString& rString, const OUString& rSearchString ) { - OUStringBuffer aRet; - sal_Int32 nIndexStart = rString.lastIndexOf( rSearchString ); - if( nIndexStart != -1 ) - { - nIndexStart += rSearchString.getLength(); - sal_Int32 nIndexEnd = rString.getLength(); - sal_Int32 nNextColon = rString.indexOf( ':', nIndexStart ); - if( nNextColon != -1 ) - nIndexEnd = nNextColon; - aRet = rString.subView(nIndexStart,nIndexEnd-nIndexStart); - } - - return aRet.makeStringAndClear(); + if( nIndexStart == -1 ) + return OUString(); + nIndexStart += rSearchString.getLength(); + sal_Int32 nIndexEnd = rString.getLength(); + sal_Int32 nNextColon = rString.indexOf( ':', nIndexStart ); + if( nNextColon != -1 ) + nIndexEnd = nNextColon; + return rString.copy(nIndexStart,nIndexEnd-nIndexStart); } sal_Int32 lcl_StringToIndex( std::u16string_view rIndexString ) |