diff options
author | Noel Grandin <noel@peralex.com> | 2013-10-25 16:43:20 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-10-31 08:34:21 +0200 |
commit | e2451bd729d0f1d795a5b689deba65bc4e9d92c6 (patch) | |
tree | 4f2356107b0e58db7afda0fc324b9eac49ff68c0 /dbaccess/source/ui/querydesign | |
parent | 460b52838fdad0352188bdd877b69cbb5f17ca63 (diff) |
Convert indexOf->startsWith and lastIndexOf->endsWith
This is both an optimisation and a cleanup.
This converts code like
aStr.indexOf("XX") == 0
to
aStr.startsWith("XX")
and converts code like
aStr.lastIndexOf("XXX") == aStr.getLength() - 3
to
aStr.endsWith("XXX")
Note that in general
aStr.lastIndexOf("X") == aStr.getLength() - 1
converts to
aStr.isEmpty() || aStr.endsWith("X")
so I used the surrounding context to determine if aStr could be empty
when modifying the code.
Change-Id: I22cb8ca7c2a4d0288b001f72adb27fd63af87669
Diffstat (limited to 'dbaccess/source/ui/querydesign')
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 30ba7170bc4d..fecdf380e7e4 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -333,14 +333,14 @@ namespace if ( pData->GetJoinType() != INNER_JOIN && _pEntryTabTo->ExistsAVisitedConn() ) { sal_Bool bBrace = sal_False; - if(!_rJoin.isEmpty() && _rJoin.lastIndexOf(')') == (_rJoin.getLength()-1)) + if(_rJoin.endsWith(")")) { bBrace = sal_True; _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1,OUString(' ')); } (_rJoin += C_AND) += BuildJoinCriteria(_xConnection,pData->GetConnLineDataList(),pData); if(bBrace) - _rJoin += OUString(')'); + _rJoin += ")"; _pEntryConn->SetVisited(sal_True); } } @@ -1531,7 +1531,7 @@ namespace // don't display the column name aCondition = aCondition.copy(aColumnName.getLength()); aCondition = aCondition.trim(); - if ( aCondition.indexOf('=',0) == 0 ) // ignore the equal sign + if ( aCondition.startsWith("=") ) // ignore the equal sign aCondition = aCondition.copy(1); if ( SQL_ISRULE(pFunction, general_set_fct ) ) |