summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/baside2b.cxx2
-rw-r--r--connectivity/source/commontools/dbtools2.cxx2
-rw-r--r--cppuhelper/source/bootstrap.cxx2
-rw-r--r--cppuhelper/source/paths.cxx4
-rw-r--r--cui/source/dialogs/SpellDialog.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx2
-rw-r--r--desktop/source/deployment/manager/dp_manager.cxx2
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx2
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--idlc/source/idlcmain.cxx4
-rw-r--r--l10ntools/source/export.cxx2
-rw-r--r--l10ntools/source/lngmerge.cxx10
-rw-r--r--sc/source/core/data/dputil.cxx6
-rw-r--r--sc/source/core/tool/interpr1.cxx4
-rw-r--r--sc/source/ui/app/inputhdl.cxx7
-rw-r--r--sc/source/ui/docshell/docfunc.cxx2
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
-rw-r--r--sc/source/ui/docshell/impex.cxx5
-rw-r--r--sd/source/filter/html/htmlex.cxx4
-rw-r--r--sfx2/source/appl/shutdownicon.cxx2
-rw-r--r--starmath/source/node.cxx4
-rw-r--r--svl/qa/unit/test_URIHelper.cxx2
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx8
-rw-r--r--svl/source/passwordcontainer/syscreds.cxx4
-rw-r--r--svtools/source/control/inettbc.cxx22
-rw-r--r--svtools/source/svhtml/htmlsupp.cxx6
-rw-r--r--svtools/source/svhtml/parhtml.cxx11
-rw-r--r--svx/source/form/formcontroller.cxx4
-rw-r--r--svx/source/sidebar/nbdtmg.cxx4
-rw-r--r--svx/source/tbxctrls/fillctrl.cxx30
-rw-r--r--svx/source/tbxctrls/itemwin.cxx10
-rw-r--r--sw/source/filter/html/htmlfldw.cxx9
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx6
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.cxx5
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx2
-rw-r--r--sw/source/ui/lingu/olmenu.cxx4
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx4
-rw-r--r--ucb/source/ucp/file/filglob.cxx6
-rw-r--r--ucb/source/ucp/ftp/ftpurl.cxx2
-rw-r--r--unotools/source/config/bootstrap.cxx4
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx13
-rw-r--r--vcl/generic/fontmanager/helper.cxx2
-rw-r--r--vcl/source/control/field.cxx2
-rw-r--r--vcl/source/filter/FilterConfigItem.cxx2
-rw-r--r--vcl/source/filter/sgvtext.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx2
-rw-r--r--xmloff/source/text/txtfldi.cxx4
47 files changed, 111 insertions, 133 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 5e23916754f7..485d69655b58 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -727,7 +727,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
if( aPortions.empty() )
return;
- if( aLine.getLength() > 0 && aLine[aLine.getLength()-1] != '"' && (aPortions.back().tokenType != TT_STRING) )
+ if( aLine.getLength() > 0 && !aLine.endsWith("\"") && (aPortions.back().tokenType != TT_STRING) )
{
GetEditView()->InsertText(OUString("\""));
//leave the cursor on it's place: inside the two double quotes
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 233d249e111f..2dcb23d338ba 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -263,7 +263,7 @@ namespace
}
if ( nColCount )
- sSql = sSql.replaceAt(sSql.getLength()-1,1,OUString(")"));
+ sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")");
return sSql;
}
}
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 81d34202db26..6522f722ca62 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -111,7 +111,7 @@ Reference< XComponentContext > SAL_CALL bootstrap()
throw BootstrapException(
"cannot convert soffice installation path to URL!");
}
- if (!path.isEmpty() && path[path.getLength() - 1] != '/') {
+ if (!path.isEmpty() && !path.endsWith("/")) {
path += "/";
}
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index 41abeb4ef370..5ff356fa2877 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -129,9 +129,7 @@ void cppu::decodeRdbUri(rtl::OUString * uri, bool * optional, bool * directory)
if (*optional) {
*uri = uri->copy(1);
}
- *directory = uri->getLength() >= 3 && (*uri)[0] == '<'
- && (*uri)[uri->getLength() - 2] == '>'
- && (*uri)[uri->getLength() - 1] == '*';
+ *directory = uri->startsWith("<") && uri->endsWith(">*");
if (*directory) {
*uri = uri->copy(1, uri->getLength() - 3);
}
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index d32a172249c5..8c7c59c0e3dc 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -524,11 +524,11 @@ namespace
OUString aString = rErrorText;
//dots are sometimes part of the spelled word but they are not necessarily part of the replacement
- bool bDot = !aString.isEmpty() && aString[aString.getLength() - 1] == '.';
+ bool bDot = aString.endsWith(".");
aString = rSuggestedReplacement;
- if(bDot && (aString.isEmpty() || aString[aString.getLength() - 1] != '.'))
+ if(bDot && (aString.isEmpty() || !aString.endsWith(".")))
aString += ".";
return aString;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 0ae085991139..c368cf0bda55 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1127,7 +1127,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
case DataType::CLOB:
- if(aText[0] != '\'' || aText[aText.getLength() -1] != '\'')
+ if(!aText.startsWith("'") || !aText.endsWith("'"))
{
aText = aText.replaceAll("'", "''");
aText = "'" + aText + "'";
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 309b32dd04c8..bc286bf2d5ed 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -1325,7 +1325,7 @@ bool PackageManagerImpl::synchronizeAddedExtensions(
bool bShared = (m_context == "shared");
if (bShared)
{
- OSL_ASSERT(title2[title2.getLength() -1] == '_');
+ OSL_ASSERT(title2.endsWith("_"));
title2 = title2.copy(0, title2.getLength() -1);
}
OUString titleEncoded = ::rtl::Uri::encode(
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 398928432038..41daf4a15c1c 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -238,7 +238,7 @@ void PackageRegistryBackend::deleteTempFolder(
erase_path( folderUrl, Reference<XCommandEnvironment>(),
false /* no throw: ignore errors */ );
- if (folderUrl[folderUrl.getLength() - 1] == '_')
+ if (folderUrl.endsWith("_"))
{
const OUString tempFile = folderUrl.copy(0, folderUrl.getLength() - 1);
erase_path( tempFile, Reference<XCommandEnvironment>(),
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index ecfca036d77e..a8e3d660ef04 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -439,7 +439,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara )
{
OUString aText(convertLineEnd(rText, LINEEND_LF));
- if (aText[aText.getLength()-1] == '\x0A')
+ if (aText.endsWith("\x0A"))
aText = aText.copy(0, aText.getLength()-1); // Delete the last break
sal_uInt16 nCount = comphelper::string::getTokenCount(aText, '\x0A');
diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx
index fbec6deb6af5..1bff70824b00 100644
--- a/idlc/source/idlcmain.cxx
+++ b/idlc/source/idlcmain.cxx
@@ -67,7 +67,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
OString outputUrl;
if (options.isValid("-O")) {
outputUrl = convertToFileUrl(options.getOption("-O"));
- if (outputUrl[outputUrl.getLength() - 1] != '/') {
+ if (!outputUrl.endsWith("/")) {
outputUrl += "/";
}
outputUrl += "stdin.urd";
@@ -112,7 +112,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
if ( options.isValid("-O") )
{
outputFile = (options.getOption("-O"));
- if ('/' != outputFile.getStr()[outputFile.getLength()-1]) {
+ if (!outputFile.endsWith("/")) {
outputFile += OString('/');
}
outputFile += strippedFileName.replaceAt(
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index f68cf29f1fe5..8b44727e26ae 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -933,7 +933,7 @@ sal_Bool Export::WriteExportList(ResData *pResData, ExportList *pExportList,
else {
sGID += ".";
sGID += pResData->sId;
- while (!sGID.isEmpty() && sGID[sGID.getLength() - 1] == '.') {
+ while (sGID.endsWith(".")) {
sGID = sGID.copy(0, sGID.getLength() - 1);
}
}
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index bed6c93c4dd6..4913bc46d700 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -138,7 +138,7 @@ void LngParser::WritePO(PoOfstream &aPOStream,
bool LngParser::isNextGroup(OString &sGroup_out, const OString &sLine_in)
{
const OString sLineTrim = sLine_in.trim();
- if ((sLineTrim[0] == '[') && (sLineTrim[sLineTrim.getLength() - 1] == ']'))
+ if (sLineTrim.startsWith("[") && sLineTrim.endsWith("]"))
{
sGroup_out = getBracketedContent(sLineTrim).trim();
return true;
@@ -184,9 +184,7 @@ sal_Bool LngParser::Merge(
{
OString sLine( *(*pLines)[ nPos ] );
sLine = sLine.trim();
- if (!sLine.isEmpty() &&
- ( sLine[0] == '[' ) &&
- ( sLine[sLine.getLength() - 1] == ']' ))
+ if ( sLine.startsWith("[") && sLine.endsWith("]") )
{
sGroup = getBracketedContent(sLine).trim();
bGroup = sal_True;
@@ -211,9 +209,7 @@ sal_Bool LngParser::Merge(
{
OString sLine( *(*pLines)[ nPos ] );
sLine = sLine.trim();
- if (!sLine.isEmpty() &&
- ( sLine[0] == '[' ) &&
- ( sLine[sLine.getLength() - 1] == ']' ))
+ if ( sLine.startsWith("[") && sLine.endsWith("]") )
{
sGroup = getBracketedContent(sLine).trim();
bGroup = sal_True;
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index 3e4a290b9504..fd15d4e1e888 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -56,11 +56,7 @@ OUString getSpecialDateName(double fValue, bool bFirst, SvNumberFormatter* pForm
bool ScDPUtil::isDuplicateDimension(const OUString& rName)
{
- if (rName.isEmpty())
- return false;
-
- sal_Unicode cLast = rName[rName.getLength()-1];
- return cLast == sal_Unicode('*');
+ return rName.endsWith("*");
}
OUString ScDPUtil::getSourceDimensionName(const OUString& rName)
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index ab792b5eb836..04c484feb15e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7192,7 +7192,7 @@ void ScInterpreter::ScAddressFunc()
}
/* TODO: yet unsupported external reference in CONV_XL_R1C1 syntax may
* need some extra handling to isolate Tab from Doc. */
- if (sTabStr[0] != '\'' || sTabStr[sTabStr.getLength()-1] != '\'')
+ if (sTabStr[0] != '\'' || !sTabStr.endsWith("'"))
ScCompiler::CheckTabQuotes( sTabStr, eConv);
if (!aDoc.isEmpty())
sTabStr = aDoc + sTabStr;
@@ -8329,7 +8329,7 @@ bool ScInterpreter::MayBeRegExp( const OUString& rStr, const ScDocument* pDoc )
{
if ( pDoc && !pDoc->GetDocOptions().IsFormulaRegexEnabled() )
return false;
- if ( rStr.isEmpty() || (rStr.getLength() == 1 && rStr[0] != '.') )
+ if ( rStr.isEmpty() || (rStr.getLength() == 1 && !rStr.startsWith(".")) )
return false; // single meta characters can not be a regexp
static const sal_Unicode cre[] = { '.','*','+','?','[',']','^','$','\\','<','>','(',')','|', 0 };
const sal_Unicode* p1 = rStr.getStr();
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 20634c9d3831..209308e4e0f1 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1426,7 +1426,7 @@ void ScInputHandler::PasteManualTip()
if ( aInsert[0] == '"' )
aInsert = aInsert.copy(1);
xub_StrLen nInsLen = aInsert.getLength();
- if ( nInsLen && aInsert[nInsLen-1] == '"' )
+ if ( aInsert.endsWith("\"") )
aInsert = aInsert.copy( 0, nInsLen-1 );
}
else if ( aSel.nEndPos )
@@ -2056,10 +2056,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
else
aStr = GetEditText(pEngine);
- if (aStr.getLength() > 3 && // Matrix-Formel ?
- aStr[0] == '{' &&
- aStr[1] == '=' &&
- aStr[aStr.getLength()-1] == '}')
+ if (aStr.startsWith("{=") && aStr.endsWith("}") ) // Matrix-Formel ?
{
aStr = aStr.copy(1, aStr.getLength() -2);
pEngine->SetText(aStr);
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 5f1c8cbbc6d5..9f2195ebcb9e 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5191,7 +5191,7 @@ sal_Bool ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNe
OUString aFormula;
pDoc->GetFormula( nStartCol, nStartRow, nTab, aFormula );
- if ( aFormula[0] == '{' && aFormula[aFormula.getLength()-1] == '}' )
+ if ( aFormula.startsWith("{") && aFormula.endsWith("}") )
{
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_RESIZEMATRIX );
if (bUndo)
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 9d1efe077b49..51f8544c32bb 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2012,7 +2012,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_Unicode c = aUniString[0];
bString = (c == cStrDelim || c == ' ' ||
- aUniString[aUniString.getLength()-1] == ' ' ||
+ aUniString.endsWith(" ") ||
aUniString.indexOf(cStrDelim) >= 0);
if (!bString && cDelim != 0)
bString = (aUniString.indexOf(cDelim) >= 0);
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 93f9782cec34..fccafbe2200f 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2022,9 +2022,8 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
* writes in SYLK. */
}
if ( pFCell->GetMatrixFlag() != MM_NONE &&
- aCellStr.getLength() > 2 &&
- aCellStr[0] == '{' &&
- aCellStr[aCellStr.getLength()-1] == '}' )
+ aCellStr.startsWith("{") &&
+ aCellStr.endsWith("}") )
{ // cut off matrix {} characters
aCellStr = aCellStr.copy(1, aCellStr.getLength()-2);
}
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 013d50d43031..4e6ad039600a 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -855,7 +855,7 @@ void HtmlExport::ExportWebCast()
if (maCGIPath.isEmpty())
maCGIPath = ".";
- if (maCGIPath[maCGIPath.getLength() - 1] != '/')
+ if (!maCGIPath.endsWith("/"))
maCGIPath += "/";
if( meScript == SCRIPT_ASP )
@@ -867,7 +867,7 @@ void HtmlExport::ExportWebCast()
if (maURLPath.isEmpty())
maURLPath = ".";
- if (maURLPath[maURLPath.getLength() - 1] != '/')
+ if (!maURLPath.endsWith("/"))
maURLPath += "/";
}
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index bafa7c2c4038..201a15323b5e 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -525,7 +525,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR
else
{
OUString aBaseDirURL = sFiles[0];
- if ( !aBaseDirURL.isEmpty() && aBaseDirURL[aBaseDirURL.getLength()-1] != '/' )
+ if ( !aBaseDirURL.isEmpty() && !aBaseDirURL.endsWith("/") )
aBaseDirURL += "/";
int iFiles;
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 2e631e207f5a..d8832a583d9e 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -802,8 +802,8 @@ void SmExpressionNode::CreateTextFromNode(OUString &rText)
pNode->CreateTextFromNode(rText);
//Just a bit of foo to make unary +asd -asd +-asd -+asd look nice
if (pNode->GetType() == NMATH)
- if ((nSize != 2) || ((rText[rText.getLength()-1] != '+') &&
- (rText[rText.getLength()-1] != '-')))
+ if ((nSize != 2) ||
+ ( !rText.endsWith("+") && !rText.endsWith("-") ))
rText += " ";
}
diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx
index 3d160d66bee5..313ce6538c96 100644
--- a/svl/qa/unit/test_URIHelper.cxx
+++ b/svl/qa/unit/test_URIHelper.cxx
@@ -162,7 +162,7 @@ css::uno::Any Content::execute(
uri += "/";
break;
case '2':
- if (uri.getLength() > 0 && uri[uri.getLength() - 1] == '/') {
+ if (uri.endsWith("/")) {
uri = uri.copy(0, uri.getLength() -1);
}
break;
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 8c4f7d28361f..ad99f8bb19bc 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -788,8 +788,8 @@ UrlRecord PasswordContainer::find(
else
{
OUString tmpUrl( aUrl );
- if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
- tmpUrl += OUString("/");
+ if ( !tmpUrl.endsWith("/") )
+ tmpUrl += "/";
aIter = m_aContainer.lower_bound( tmpUrl );
if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) )
@@ -919,7 +919,7 @@ void SAL_CALL PasswordContainer::remove( const OUString& aURL, const OUString& a
if( aInd > 0 && aUrl.getLength()-1 == aInd )
aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
else
- aUrl += OUString("/");
+ aUrl += "/";
aIter = m_aContainer.find( aUrl );
}
@@ -960,7 +960,7 @@ void SAL_CALL PasswordContainer::removePersistent( const OUString& aURL, const O
if( aInd > 0 && aUrl.getLength()-1 == aInd )
aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
else
- aUrl += OUString("/");
+ aUrl += "/";
aIter = m_aContainer.find( aUrl );
}
diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx
index 9423acfc005f..5bd60dcf8537 100644
--- a/svl/source/passwordcontainer/syscreds.cxx
+++ b/svl/source/passwordcontainer/syscreds.cxx
@@ -141,8 +141,8 @@ namespace
else
{
OUString tmpUrl( aUrl );
- if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
- tmpUrl += OUString("/");
+ if ( !tmpUrl.endsWith("/") )
+ tmpUrl += "/";
aIter = rContainer.lower_bound( tmpUrl );
if( aIter != rContainer.end() && aIter->match( tmpUrl ) )
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 00dbfbb21d45..ec9de0deba67 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -240,7 +240,7 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, )
// note: if this doesn't work, we're not interested in: we're checking the
// untouched sCompletion then
- if ( !sURL.isEmpty() && ( sURL[sURL.getLength()-1] != '/' ))
+ if ( !sURL.isEmpty() && !sURL.endsWith("/") )
{
OUString sUpperURL( sURL.toAsciiUpperCase() );
@@ -316,9 +316,9 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
#endif
sal_Bool bExectMatch = bPureHomePath
- || aText.compareTo( "." ) == 0
- || (aText.getLength() > 1 && aText.copy( aText.getLength() - 2, 2 ).compareTo( "/." ) == 0)
- || (aText.getLength() > 2 && aText.copy( aText.getLength() - 3, 3 ).compareTo( "/.." ) == 0);
+ || aText == "."
+ || aText.endsWith("/.")
+ || aText.endsWith("/..");
// for pure home paths ( ~username ) the '.' at the end of rMatch
// means that it poits to root catalog
@@ -346,7 +346,7 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
aMatchName = aMatchName.toAsciiLowerCase();
// if the matchstring ends with a slash, we must search for this also
- if ( rMatch[ rMatch.getLength()-1 ] == '/' )
+ if ( rMatch.endsWith("/") )
aMatchName += "/";
}
@@ -435,7 +435,7 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
OUString aInput( aText );
if ( nMatchLen )
{
- if ((aText.getLength() && aText[ aText.getLength() - 1 ] == '.') || bPureHomePath)
+ if (aText.endsWith(".") || bPureHomePath)
{
// if a "special folder" URL was typed, don't touch the user input
aMatch = aMatch.copy( nMatchLen );
@@ -508,7 +508,7 @@ OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, const OUStrin
// HRO: INetURLObject::smatRel2Abs does not recognize '\\' as a relative path
// but in case of "\\\\" INetURLObject is right - this is an absolute path !
- if( aText.indexOf( '\\' ) == 0 && (aText.getLength() < 2 || aText[ 1 ] != '\\') )
+ if( aText.startsWith("\\") && (aText.getLength() < 2 || aText[ 1 ] != '\\') )
{
// cut to first segment
OUString aTmp = INetURLObject::GetScheme( eBaseProt );
@@ -535,7 +535,7 @@ OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, const OUStrin
INetURLObject aTmp( aObj.smartRel2Abs( aSmart, bWasAbsolute ) );
#endif
- if ( aText[ aText.getLength() - 1 ] == '.' )
+ if ( aText.endsWith(".") )
// INetURLObject appends a final slash for the directories "." and "..", this is a bug!
// Remove it as a workaround
aTmp.removeFinalSlash();
@@ -788,7 +788,7 @@ void SvtMatchContext_Impl::doExecute()
if( bFull )
continue;
- if( aText.compareTo( aCurMainURL, aText.getLength() ) == 0 )
+ if( aCurMainURL.startsWith(aText) )
{
if( aText.getLength() < aCurMainURL.getLength() )
Insert( aCurMainURL, aCurMainURL );
@@ -978,7 +978,7 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
if ( !aURL.isEmpty() )
{
- sal_Bool bFound = aURL[aURL.getLength()-1] == '/' ;
+ sal_Bool bFound = aURL.endsWith("/");
if ( !bFound )
{
OUString aUpperURL( aURL );
@@ -1363,7 +1363,7 @@ sal_Bool SvtURLBox_Impl::TildeParsing(
}
else
{
- if( aParseTilde[ aParseTilde.getLength() - 1 ] != '/' )
+ if( !aParseTilde.endsWith("/") )
aParseTilde += "/";
if( aText.getLength() > 2 )
aParseTilde += aText.copy( 2 );
diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx
index 829e8f3b2a19..f1de1c0e3313 100644
--- a/svtools/source/svhtml/htmlsupp.cxx
+++ b/svtools/source/svhtml/htmlsupp.cxx
@@ -96,8 +96,7 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, sal_Bool bFull )
// remove SGML comments
- if( rString.getLength() >= 4 &&
- rString.startsWith( "<!--" ) )
+ if( rString.startsWith( "<!--" ) )
{
sal_Int32 nPos = 3;
if( bFull )
@@ -117,8 +116,7 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, sal_Bool bFull )
rString = rString.copy( nPos, rString.getLength() - nPos );
}
- if( rString.getLength() >=3 &&
- rString.endsWith("-->") )
+ if( rString.endsWith("-->") )
{
rString = rString.copy( 0, rString.getLength()-3 );
if( bFull )
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index b7292594c523..dd90ac37d79b 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -907,8 +907,7 @@ int HTMLParser::_GetNextRawToken()
: aTok.compareTo(aEndToken) );
}
}
- if( bReadComment && '>'==nNextCh && aTok.getLength() >= 2 &&
- aTok.endsWith( "--" ) )
+ if( bReadComment && '>'==nNextCh && aTok.endsWith( "--" ) )
{
// End of comment of style <!----->
bReadComment = false;
@@ -1214,8 +1213,7 @@ int HTMLParser::_GetNextToken()
// generate pending HTML_<TOKEN>_OFF for HTML_<TOKEN>_ON
// Do not convert this to a single HTML_<TOKEN>_OFF
// which lead to fdo#56772.
- if ((HTML_TOKEN_ONOFF & nRet) && (aToken.getLength() >= 1) &&
- ('/' == aToken[aToken.getLength()-1]))
+ if ((HTML_TOKEN_ONOFF & nRet) && aToken.endsWith("/"))
{
mnPendingOffToken = nRet + 1; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF
aToken = aToken.replaceAt( aToken.getLength()-1, 1, ""); // remove trailing '/'
@@ -1275,8 +1273,7 @@ int HTMLParser::_GetNextToken()
// Read until closing %>. If not found restart at first >.
while( !bDone && !rInput.IsEof() && IsParserWorking() )
{
- bDone = '>'==nNextCh && aToken.getLength() >= 1 &&
- '%' == aToken[ aToken.getLength()-1 ];
+ bDone = '>'==nNextCh && aToken.endsWith("%");
if( !bDone )
{
aToken += OUString(nNextCh);
@@ -2127,7 +2124,7 @@ bool HTMLParser::ParseMetaOptionsImpl(
if ( bHTTPEquiv && i_pHTTPHeader )
{
// Netscape seems to just ignore a closing ", so we do too
- if ( !aContent.isEmpty() && '"' == aContent[ aContent.getLength()-1 ] )
+ if ( aContent.endsWith("\"") )
{
aContent = aContent.copy( 0, aContent.getLength() - 1 );
}
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index cb21a59074ae..dcd2b18aa2eb 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -3220,10 +3220,10 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
if (aRow.find((*iter).xText) != aRow.end())
{
OUString aCompText = aRow[(*iter).xText];
- aCompText += OUString(" ");
+ aCompText += " ";
OString aVal = m_xParser->getContext().getIntlKeywordAscii(IParseContext::KEY_AND);
aCompText += OUString(aVal.getStr(),aVal.getLength(),RTL_TEXTENCODING_ASCII_US);
- aCompText += OUString(" ");
+ aCompText += " ";
aCompText += ::comphelper::getString(pRefValues[j].Value);
aRow[(*iter).xText] = aCompText;
}
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index da61e05cdf57..fbe446a2159a 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -1834,8 +1834,8 @@ sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uIn
aFmt.SetBulletFont( &rActBulletFont );
sal_Unicode cChar = 0;
- if( pLevelSettings->sBulletChar.getLength() )
- cChar = pLevelSettings->sBulletChar.getStr()[0];
+ if( !pLevelSettings->sBulletChar.isEmpty() )
+ cChar = pLevelSettings->sBulletChar[0];
if( Application::GetSettings().GetLayoutRTL() )
{
if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] )
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index e8b45dc07bc5..499bccf54fa9 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -28,8 +28,8 @@
#define DELAY_TIMEOUT 300
-#define TMP_STR_BEGIN '['
-#define TMP_STR_END ']'
+#define TMP_STR_BEGIN "["
+#define TMP_STR_END "]"
#include "svx/drawitem.hxx"
#include "svx/xattr.hxx"
@@ -259,13 +259,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary color
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
//pFillAttrLB->SetUpdateMode( sal_False );
sal_uInt16 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr );
@@ -293,13 +293,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr );
XGradientList aGradientList( "" );
@@ -338,13 +338,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr );
XHatchList aHatchList( "" );
@@ -390,13 +390,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XBitmapEntry* pEntry = new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr);
XBitmapListRef xBitmapList =
@@ -673,7 +673,7 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox )
{
// Entry gets tested against temporary color
OUString aTmpStr = pLbFillAttr->GetSelectEntry();
- if( aTmpStr[0] == TMP_STR_BEGIN && aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) && aTmpStr.endsWith(TMP_STR_END) )
{
aTmpStr = aTmpStr.copy(1, aTmpStr.getLength()-2);
}
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 6435eaa2553d..3d10cb337d33 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -28,8 +28,8 @@
#include <svx/dialogs.hrc>
-#define TMP_STR_BEGIN '['
-#define TMP_STR_END ']'
+#define TMP_STR_BEGIN "["
+#define TMP_STR_END "]"
#define DELAY_TIMEOUT 100
@@ -318,13 +318,13 @@ void SvxColorBox::Update( const XLineColorItem* pItem )
{
// Last entry gets tested against temporary color
aTmpStr = GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
sal_uInt16 nPos = InsertEntry( aColor, aTmpStr );
SelectEntryPos( nPos );
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index ceca41810ab1..8a3f247f8087 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -464,10 +464,9 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt )
const OUString& rComment = pFld->GetPar2();
sal_Bool bWritten = sal_False;
- if( (rComment.getLength() >= 6 && '<' == rComment[0] &&
- '>' == rComment[rComment.getLength()-1] &&
- rComment.copy( 1, 4 ).equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_meta) ) ||
- (rComment.getLength() >= 7 &&
+ if( (rComment.getLength() >= 6 && rComment.startsWith("<") && rComment.endsWith(">") &&
+ rComment.copy( 1, 4 ).equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_meta) ) ||
+ (rComment.getLength() >= 7 &&
rComment.startsWith( "<!--" ) &&
rComment.endsWith( "-->" )) )
{
@@ -481,7 +480,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt )
bWritten = sal_True;
}
else if( rComment.getLength() >= 7 &&
- '>' == rComment[rComment.getLength()-1] &&
+ rComment.endsWith(">") &&
rComment.startsWithIgnoreAsciiCase( "HTML:" ) )
{
OUString sComment(comphelper::string::stripStart(rComment.copy(5), ' '));
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index af740e6ed9cc..2ce43f289269 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -219,7 +219,7 @@ OUString SwWW8ImplReader::ConvertFFileName(const OUString& rOrg)
aName = aName.replaceAll("%20", OUString(' '));
// remove attached quotation marks
- if (!aName.isEmpty() && '"' == aName[aName.getLength()-1])
+ if (aName.endsWith("\""))
aName = aName.copy(0, aName.getLength()-1);
// Need the more sophisticated url converter.
@@ -2107,7 +2107,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr)
? true : false;
bNewVText = false;
}
- else if( aVText[aVText.getLength()-1] == ']' )
+ else if( aVText.endsWith("]") )
bBracket = false;
}
break;
@@ -3335,7 +3335,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr
if ( aReadParam.SkipToNextToken()==-2 )
{
sMark = aReadParam.GetResult();
- if( !sMark.isEmpty() && '"' == sMark[ sMark.getLength()-1 ])
+ if( sMark.endsWith("\""))
sMark = sMark.copy( 0, sMark.getLength() - 1 );
}
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
index 00f576138263..0995300f89d6 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -421,7 +421,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog(
{
OUString sHeader = sLine.getToken( 0, '\t', nIndex );
OSL_ENSURE(sHeader.getLength() > 2 &&
- sHeader[0] == '\"' && sHeader[sHeader.getLength() - 1] == '\"',
+ sHeader.startsWith("\"") && sHeader.endsWith("\""),
"Wrong format of header");
if(sHeader.getLength() > 2)
{
@@ -438,8 +438,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog(
for( sal_Int32 nToken = 0; nToken < nDataCount; ++nToken)
{
OUString sData = sLine.getToken( 0, '\t', nIndex );
- OSL_ENSURE(sData.getLength() >= 2 &&
- sData[0] == '\"' && sData[sData.getLength() - 1] == '\"',
+ OSL_ENSURE( sData.startsWith("\"") && sData.endsWith("\""),
"Wrong format of line");
if(sData.getLength() >= 2)
aNewData.push_back(sData.copy(1, sData.getLength() - 2));
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index b46640a21348..94b9ec966dfa 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1354,7 +1354,7 @@ void AddressMultiLineEdit::SetText( const OUString& rStr )
{
xub_StrLen nIndex = 0;
OUString sPara = pTextEngine->GetText( nPara );
- if(!sPara.isEmpty() && sPara[sPara.getLength() - 1] != ' ')
+ if(!sPara.isEmpty() && !sPara.endsWith(" "))
{
TextPaM aPaM(nPara, sPara.getLength());
pTextEngine->ReplaceText(TextSelection( aPaM ), OUString(' '));
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index 474179be91c9..687d9a25a37c 100644
--- a/sw/source/ui/lingu/olmenu.cxx
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -677,8 +677,8 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
// if orginal word has a trailing . (likely the end of a sentence)
// and the replacement text hasn't, then add it to the replacement
if (!aTmp.isEmpty() && !aOrig.isEmpty() &&
- '.' == aOrig[ aOrig.getLength() - 1] && /* !IsAlphaNumeric ??*/
- '.' != aTmp[ aTmp.getLength() - 1])
+ aOrig.endsWith(".") && /* !IsAlphaNumeric ??*/
+ !aTmp.endsWith("."))
{
aTmp += ".";
}
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 81590189371f..d7987c6f487f 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -569,7 +569,7 @@ namespace cmis
OUString sPath = m_sObjectPath;
// Get rid of the trailing slash problem
- if ( sPath[ sPath.getLength( ) - 1 ] == '/' )
+ if ( sPath.endsWith("/") )
sPath = sPath.copy( 0, sPath.getLength() - 1 );
// Get the last segment
@@ -1862,7 +1862,7 @@ namespace cmis
URL aUrl( m_sURL );
OUString sPath( m_sObjectPath );
- if ( sPath[sPath.getLength( ) - 1] != '/' )
+ if ( !sPath.endsWith("/") )
sPath += "/";
sPath += STD_TO_OUSTR( ( *it )->getName( ) );
OUString sId = STD_TO_OUSTR( ( *it )->getId( ) );
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index e2172875fcfa..e830a5e1d5b2 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -199,11 +199,11 @@ namespace fileaccess {
sal_Int32 lastIndex = aFileName.lastIndexOf( sal_Unicode('/') );
OUString aParent = aFileName.copy( 0,lastIndex );
- if( aParent[ aParent.getLength()-1] == sal_Unicode(':') && aParent.getLength() == 6 )
- aParent += OUString("/");
+ if( aParent.endsWith(":") && aParent.getLength() == 6 )
+ aParent += "/";
if ( aParent == "file://" )
- aParent = OUString("file:///");
+ aParent = "file:///";
return aParent;
}
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index 70c15c4e84fa..ba0e29840dca 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -278,7 +278,7 @@ OUString FTPURL::ident(bool withslash,bool internal) const
else
bff.append(sal_Unicode('/')).append(m_aPathSegmentVec[i]);
if(withslash)
- if(!bff.isEmpty() && bff[bff.getLength()-1] != sal_Unicode('/'))
+ if(!bff.isEmpty() && bff[bff.getLength()-1] != '/')
bff.append(sal_Unicode('/'));
bff.append(m_aType);
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index fb213a35ff31..f05e204937fe 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -209,7 +209,7 @@ bool implNormalizeURL(OUString & _sURL, osl::DirectoryItem& aDirItem)
// #109863# sal/osl returns final slash for file URLs contradicting
// the URL/URI RFCs.
- if ( aNormalizedURL.getStr()[aNormalizedURL.getLength()-1] != cURLSeparator )
+ if ( !aNormalizedURL.endsWith(OUString(cURLSeparator)) )
_sURL = aNormalizedURL;
else
_sURL = aNormalizedURL.copy( 0, aNormalizedURL.getLength()-1 );
@@ -326,7 +326,7 @@ PathStatus getDerivedPath(
// do we have a base path ?
if (!_aBaseURL.isEmpty())
{
- OSL_PRECOND(_aBaseURL[_aBaseURL.getLength()-1] != cURLSeparator,"Unexpected: base URL ends in slash");
+ OSL_PRECOND(!_aBaseURL.endsWith(OUString(cURLSeparator)), "Unexpected: base URL ends in slash");
sDerivedURL = OUStringBuffer(_aBaseURL).append(cURLSeparator).append(_sRelativeURL).makeStringAndClear();
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 13128b6880bd..0ffae6db625a 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -64,11 +64,11 @@ OUString getParentName( const OUString& aFileName )
sal_Int32 lastIndex = aFileName.lastIndexOf( sal_Unicode('/') );
OUString aParent = aFileName.copy( 0, lastIndex );
- if( aParent[ aParent.getLength()-1] == sal_Unicode(':') && aParent.getLength() == 6 )
- aParent += OUString("/");
+ if( aParent.endsWith(":") && aParent.getLength() == 6 )
+ aParent += "/";
if( 0 == aParent.compareToAscii( "file://" ) )
- aParent = OUString("file:///");
+ aParent = "file:///";
return aParent;
}
@@ -80,7 +80,7 @@ bool ensuredir( const OUString& rUnqPath )
return false;
// remove trailing slash
- if ( rUnqPath[ rUnqPath.getLength() - 1 ] == sal_Unicode( '/' ) )
+ if ( rUnqPath.endsWith("/") )
aPath = rUnqPath.copy( 0, rUnqPath.getLength() - 1 );
else
aPath = rUnqPath;
@@ -172,8 +172,7 @@ OUString ConstructTempDir_Impl( const OUString* pParent )
}
// Make sure that directory ends with a separator
- sal_Int32 i = aName.getLength();
- if( i>0 && aName[i-1] != '/' )
+ if( !aName.isEmpty() && !aName.endsWith("/") )
aName += "/";
return aName;
@@ -434,7 +433,7 @@ OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName )
OUString aUnqPath( rBaseName );
// remove trailing slash
- if ( rBaseName[ rBaseName.getLength() - 1 ] == sal_Unicode( '/' ) )
+ if ( rBaseName.endsWith("/") )
aUnqPath = rBaseName.copy( 0, rBaseName.getLength() - 1 );
// try to create the directory
diff --git a/vcl/generic/fontmanager/helper.cxx b/vcl/generic/fontmanager/helper.cxx
index 6d99dca66c01..bf09d6058cc8 100644
--- a/vcl/generic/fontmanager/helper.cxx
+++ b/vcl/generic/fontmanager/helper.cxx
@@ -358,7 +358,7 @@ void psp::normPath( OString& rPath )
// on many different platforms let's play it safe
OString aPath = rPath.replaceAll("//", "/");
- if( !aPath.isEmpty() && aPath[aPath.getLength()-1] == '/' )
+ if( aPath.endsWith("/") )
aPath = aPath.copy(0, aPath.getLength()-1);
if( ( aPath.indexOf("./") != -1 ||
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 401f0a1f0d33..44921475cae7 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -118,7 +118,7 @@ static bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
// negative?
if ( bCurrency )
{
- if ( aStr[0] == '(' && aStr[aStr.getLength()-1] == ')' )
+ if ( aStr.startsWith("(") && aStr.endsWith(")") )
bNegative = true;
if ( !bNegative )
{
diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx
index da328f29a5d5..f63963527666 100644
--- a/vcl/source/filter/FilterConfigItem.cxx
+++ b/vcl/source/filter/FilterConfigItem.cxx
@@ -51,7 +51,7 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory >& rXCfgProv, co
if ( rTree[0] == '/' )
++i;
- if ( rTree[rTree.getLength() - 1] == '/' )
+ if ( rTree.endsWith("/") )
--nTokenCount;
Any aAny;
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx
index 3cadc838804a..113cfff9eb93 100644
--- a/vcl/source/filter/sgvtext.cxx
+++ b/vcl/source/filter/sgvtext.cxx
@@ -1134,7 +1134,7 @@ void SgfFontOne::ReadOne( const OString& rID, OString& Dsc )
if ( Dsc.getLength() < 2 || ( Dsc[Dsc.getLength() - 1] !=')' ) )
return;
- i=Dsc.getLength()-2; // hier ist die ')' des SV-Fontnames
+ i = Dsc.getLength()-2; // hier ist die ')' des SV-Fontnames
sal_Int32 j=0;
while ( i > 0 && ( Dsc[i] != '(' ) )
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2150362a9ee0..0ae63e6309ae 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2217,7 +2217,7 @@ void FieldContext::AppendCommand(const OUString& rPart)
bInStringNext = true;
sToken = sToken.copy(1);
}
- if (sToken.getStr()[sToken.getLength() - 1] == '"')
+ if (sToken.endsWith("\""))
{
bInStringNext = false;
sToken = sToken.copy(0, sToken.getLength() - 1);
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 27c63738e5c3..74bcc18dcde0 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -1042,12 +1042,12 @@ void XMLPlaceholderFieldImportContext::PrepareField(
OUString aContent = GetContent();
sal_Int32 nStart = 0;
sal_Int32 nLength = aContent.getLength();
- if ((nLength > 0) && (aContent.getStr()[0] == '<'))
+ if (aContent.startsWith("<"))
{
--nLength;
++nStart;
}
- if ((nLength > 0) && (aContent.getStr()[aContent.getLength()-1] == '>'))
+ if (aContent.endsWith(">"))
{
--nLength;
}