summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2022-09-05 21:47:53 +0200
committerJulien Nabet <serval2412@yahoo.fr>2022-09-08 18:57:50 +0200
commit3a1b2c2b01bba0f1aeff52067110c44b68cd31be (patch)
treeb0409439a4be09aa60b388509526a5ce8e8fe2b8 /connectivity
parent4182f3cda4add3920c797087872b81f0212c2ae7 (diff)
Simplify by using replace instead of replaceAt in loop in connectivity (3)
Change-Id: If7517356959d4720bbe07acea822ec835a681a17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139456 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/resource/sharedresources.cxx15
1 files changed, 4 insertions, 11 deletions
diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx
index 0f8bccefd96b..cc6f65e64541 100644
--- a/connectivity/source/resource/sharedresources.cxx
+++ b/connectivity/source/resource/sharedresources.cxx
@@ -100,20 +100,13 @@ namespace connectivity
namespace
{
- size_t lcl_substitute( OUString& _inout_rString,
+ bool lcl_substitute( OUString& _inout_rString,
const char* _pAsciiPattern, std::u16string_view _rReplace )
{
- size_t nOccurrences = 0;
-
+ OUString oldString = _inout_rString;
OUString sPattern( OUString::createFromAscii( _pAsciiPattern ) );
- sal_Int32 nIndex = 0;
- while ( ( nIndex = _inout_rString.indexOf( sPattern ) ) > -1 )
- {
- ++nOccurrences;
- _inout_rString = _inout_rString.replaceAt( nIndex, sPattern.getLength(), _rReplace );
- }
-
- return nOccurrences;
+ _inout_rString = _inout_rString.replaceAll(sPattern, _rReplace);
+ return oldString != _inout_rString;
}
}