diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-03-04 16:20:50 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-04-06 23:41:12 +0200 |
commit | cca2e42926a14ec27c663cd0f495dccb7607d6f9 (patch) | |
tree | 2f9155019eb06ea753a7ab39cd9c9fce45199477 | |
parent | 86015855a98795d00a28f1bb65c41df947563d66 (diff) |
Use getTokenCount and indexed getToken
Change-Id: Id57a1771c897c69b05d02a359f22e5fb2b1f5a31
Reviewed-on: https://gerrit.libreoffice.org/69239
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
-rw-r--r-- | forms/source/component/ListBox.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index d6857dcfdcf8..fcf16abe66b4 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -42,6 +42,7 @@ #include <comphelper/basicio.hxx> #include <comphelper/property.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/formattedcolumnvalue.hxx> @@ -637,19 +638,12 @@ namespace frm OUString sListSource; _rxInStream >> sListSource; - sal_Int32 nTokens = 1; - const sal_Unicode* pStr = sListSource.getStr(); - while ( *pStr ) - { - if ( *pStr == ';' ) - nTokens++; - pStr++; - } + const sal_Int32 nTokens{ comphelper::string::getTokenCount(sListSource, ';') }; aListSourceSeq.realloc( nTokens ); + sal_Int32 nIdx{ 0 }; for (sal_Int32 i=0; i<nTokens; ++i) { - sal_Int32 nTmp = 0; - aListSourceSeq.getArray()[i] = sListSource.getToken(i,';',nTmp); + aListSourceSeq.getArray()[i] = sListSource.getToken(0, ';', nIdx); } } else |