diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-08-12 22:13:15 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-09-09 21:07:50 +0200 |
commit | a9bcbd3dad16c69f1e7ebb52a30611150a49f298 (patch) | |
tree | 44b03b80d6429efeedd1f7029eaba4ea23ab6773 /sc | |
parent | c8796e9f1fe5a77953dd5089581b2e8569533de9 (diff) |
Avoid getTokenCount and use indexed getToken
Change-Id: I1a52508c782c980d369a74f70fc8db5cbe1a0296
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/dbgui/validate.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 688ebe5b7043..78d2c154c319 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -277,12 +277,16 @@ ScConditionMode lclGetCondModeFromPos( sal_uInt16 nLbPos ) void lclGetFormulaFromStringList( OUString& rFmlaStr, const OUString& rStringList, sal_Unicode cFmlaSep ) { rFmlaStr.clear(); - sal_Int32 nTokenCnt = comphelper::string::getTokenCount(rStringList, '\n'); - for( sal_Int32 nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken ) + if (!rStringList.isEmpty()) { - OUString aToken( rStringList.getToken( 0, '\n', nStringIx ) ); - ScGlobal::AddQuotes( aToken, '"' ); - rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep); + sal_Int32 nIdx {0}; + do + { + OUString aToken {rStringList.getToken( 0, '\n', nIdx )}; + ScGlobal::AddQuotes( aToken, '"' ); + rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep); + } + while (nIdx>0); } if( rFmlaStr.isEmpty() ) rFmlaStr = "\"\""; |