summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2018-09-09 18:32:49 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2018-09-09 21:08:01 +0200
commit5b383e1feece636cce3e90eb6a49221dfa5a2a5a (patch)
tree92c1db62d9aa30fb51ba57e304a3b2c32f5f18a7
parent31fca96e53e59e810da136e8448b8e6986c44afa (diff)
Avoid getTokenCount()
Change-Id: I4f0f921a177e10fc896a12b2bea8aaced1cacf0d
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index e4c2e5622954..706289ef6f7d 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -95,17 +95,22 @@ CSVImportOptionsIndex getSkipEmptyCellsIndex( ScImportAsciiCall eCall )
static void lcl_FillCombo( ComboBox& rCombo, const OUString& rList, sal_Unicode cSelect )
{
- sal_Int32 i;
- sal_Int32 nCount = comphelper::string::getTokenCount(rList, '\t');
- for ( i=0; i<nCount; i+=2 )
- rCombo.InsertEntry( rList.getToken(i,'\t') );
+ OUString aStr;
+ if (!rList.isEmpty())
+ {
+ sal_Int32 nIdx {0};
+ do
+ {
+ const OUString sEntry {rList.getToken(0, '\t', nIdx)};
+ rCombo.InsertEntry( sEntry );
+ if (nIdx>0 && static_cast<sal_Unicode>(rList.getToken(0, '\t', nIdx).toInt32()) == cSelect)
+ aStr = sEntry;
+ }
+ while (nIdx>0);
+ }
if ( cSelect )
{
- OUString aStr;
- for ( i=0; i<nCount; i+=2 )
- if ( static_cast<sal_Unicode>(rList.getToken(i+1,'\t').toInt32()) == cSelect )
- aStr = rList.getToken(i,'\t');
if (aStr.isEmpty())
aStr = OUString(cSelect); // Ascii