sc/source/core/data/global2.cxx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
New commits: commit ef1827ff7c753500c0e94943e69ada0f22c1924f Author: Julien Nabet <[email protected]> AuthorDate: Fri Sep 16 08:57:52 2022 +0200 Commit: Julien Nabet <[email protected]> CommitDate: Fri Sep 16 15:32:00 2022 +0200 Simplify by using replaceAll instead of replaceAt in a loop (sc/global2) Change-Id: I26a51eb3b4d5e6a0d8903c348bd0e6084521f117 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140039 Tested-by: Jenkins Reviewed-by: Eike Rathke <[email protected]> diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index ab731b2a923d..6f8352fd1862 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -324,15 +324,9 @@ OUString ScGlobal::GetAbsDocName( const OUString& rFileName, OUString ScGlobal::GetDocTabName( std::u16string_view rFileName, std::u16string_view rTabName ) { - OUString aDocTab = OUString::Concat("'") + rFileName; - sal_Int32 nPos = 1; - while( (nPos = aDocTab.indexOf( '\'', nPos )) != -1 ) - { // escape Quotes - aDocTab = aDocTab.replaceAt( nPos, 0, u"\\" ); - nPos += 2; - } - aDocTab += "'" + OUStringChar(SC_COMPILER_FILE_TAB_SEP) + rTabName; - // "'Doc'#Tab" + OUString aDocTab(rFileName); + // "'Doc'#Tab" + aDocTab = "'" + aDocTab.replaceAll(u"'", u"\\'") + "'" + OUStringChar(SC_COMPILER_FILE_TAB_SEP) + rTabName; return aDocTab; }
