diff options
author | Eike Rathke <erack@redhat.com> | 2018-09-17 22:43:46 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-09-18 11:17:17 +0200 |
commit | 1c54cd50d5a393a09e9f82bc24100683c1ba24ed (patch) | |
tree | ae35e6ac005e9b1a794f6f10f016aa6013bcdfae /svl | |
parent | 6927f127699ac47c0989df23c5b0d00ab067e20f (diff) |
Use !startsWith() instead of indexOf()!=0
Faster and even easier to read.
Change-Id: I0146f70ea250e68887ac5d8dd5a10fe7e6a90eeb
Reviewed-on: https://gerrit.libreoffice.org/60648
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index b3589ed7c601..bb54df73ef02 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -698,7 +698,7 @@ short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos { // skip the gap of colors et al between new and old keywords and search on i = NF_KEY_LASTKEYWORD; - while ( i > 0 && sString.indexOf(rKeyword[i]) != 0 ) + while ( i > 0 && !sString.startsWith( rKeyword[i]) ) { i--; } @@ -707,7 +707,7 @@ short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos // found something, but maybe it's something else? // e.g. new NNN is found in NNNN, for NNNN we must search on short j = i - 1; - while ( j > 0 && sString.indexOf(rKeyword[j]) != 0 ) + while ( j > 0 && !sString.startsWith( rKeyword[j]) ) { j--; } @@ -722,7 +722,7 @@ short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos // are localized. That was already checked in // SetDependentKeywords(). i = NF_KEY_LASTKEYWORD; - while ( i > 0 && sString.indexOf(sEnglishKeyword[i]) != 0 ) + while ( i > 0 && !sString.startsWith( sEnglishKeyword[i]) ) { i--; } @@ -731,7 +731,7 @@ short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos // found something, but maybe it's something else? // e.g. new NNN is found in NNNN, for NNNN we must search on short j = i - 1; - while ( j > 0 && sString.indexOf(sEnglishKeyword[j]) != 0 ) + while ( j > 0 && !sString.startsWith( sEnglishKeyword[j]) ) { j--; } |