From 8f5629fd5aafc85e509a4160a11a285b0a66e7c0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 11 Jun 2012 13:15:18 +0100 Subject: remove EraseLeadingChars and EraseTrailingChars Change-Id: Ib9797fe97cd008cc6508ce8cec47dc5373416892 --- dbaccess/source/core/misc/dsntypes.cxx | 7 +++---- dbaccess/source/filter/xml/xmlExport.cxx | 4 ++-- dbaccess/source/ui/browser/brwctrlr.cxx | 3 ++- dbaccess/source/ui/dlg/queryfilter.cxx | 4 ++-- dbaccess/source/ui/misc/HtmlReader.cxx | 18 ++++++++---------- dbaccess/source/ui/misc/RtfReader.cxx | 4 ++-- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 5 ++--- dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 3 +-- 8 files changed, 22 insertions(+), 26 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index 09c9d337be58..7925038e6c60 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -139,7 +139,7 @@ String ODsnTypeCollection::getPrefix(const ::rtl::OUString& _sURL) const sRet = aIter->Copy(0,sURL.Match(*aIter)); else sRet = sURL.Copy(0,aIter->Match(sURL)); - sRet.EraseTrailingChars('*'); + sRet = comphelper::string::stripEnd(sRet, '*'); sOldPattern = *aIter; } } @@ -205,7 +205,7 @@ String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const ::rtl::OUStrin if ( !sURL.Len() && sFallbackURL.Len() ) sURL = sFallbackURL; - sURL.EraseTrailingChars('*'); + sURL = comphelper::string::stripEnd(sURL, '*'); return sURL; } // ----------------------------------------------------------------------------- @@ -344,8 +344,7 @@ ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const //------------------------------------------------------------------------- DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const { - String sDsn(_rDsn); - sDsn.EraseTrailingChars('*'); + String sDsn(comphelper::string::stripEnd(_rDsn, '*')); sal_uInt16 nSeparator = sDsn.Search((sal_Unicode)':'); if (STRING_NOTFOUND == nSeparator) { diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 074d2093dad9..d5e1b6f640c7 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "xmlstrings.hrc" #include "xmlEnums.hxx" @@ -601,8 +602,7 @@ void ODBExport::exportConnectionData() { SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True); { - String sType = m_aTypeCollection.getPrefix(sValue); - sType.EraseTrailingChars(':'); + String sType = comphelper::string::stripEnd(m_aTypeCollection.getPrefix(sValue), ':'); AddAttribute(XML_NAMESPACE_DB,XML_TYPE,sType); AddAttribute(XML_NAMESPACE_DB,XML_HOSTNAME,sHostName); if ( nPort != -1 ) diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index e0189ed94e41..0beff91f7900 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -76,6 +76,7 @@ #include #include #include +#include #include #include #include @@ -2565,7 +2566,7 @@ IMPL_LINK(SbaXDataBrowserController, OnSearchContextRequest, FmSearchContext*, p pContext->arrFields.push_back(xCurrentColumn); } - sFieldList.EraseTrailingChars(';'); + sFieldList = comphelper::string::stripEnd(sFieldList, ';'); pContext->xCursor.set(getRowSet(),UNO_QUERY); pContext->strUsedFields = sFieldList; diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 9d481ac11d58..51bbed99513c 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -487,7 +487,7 @@ void DlgFilterCrit::SetLine( sal_uInt16 nIdx,const PropertyValue& _rItem,sal_Boo _rItem.Value >>= aCondition; String aStr = aCondition.getStr(); ::Replace_SQL_PlaceHolder(aStr); - aStr.EraseTrailingChars(); + aStr = comphelper::string::stripEnd(aStr, ' '); Reference< XPropertySet > xColumn = getColumn( _rItem.Name ); @@ -525,7 +525,7 @@ void DlgFilterCrit::SetLine( sal_uInt16 nIdx,const PropertyValue& _rItem,sal_Boo aStr.Erase(0,11); break; } - aStr.EraseLeadingChars(); + aStr = comphelper::string::stripStart(aStr, ' '); // to make sure that we only set first three ListBox* pColumnListControl = NULL; diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 56648b980475..758cee6868b5 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include "dbu_misc.hrc" #include "dbustrings.hrc" #include @@ -396,9 +397,10 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont,sal_Int32 &_rTextColor) String aFontName; xub_StrLen nPos = 0; while( nPos != STRING_NOTFOUND ) - { // Fontliste, VCL: Semikolon als Separator, HTML: Komma + { + // Fontliste, VCL: Semikolon als Separator, HTML: Komma String aFName = rFace.GetToken( 0, ',', nPos ); - aFName.EraseTrailingChars().EraseLeadingChars(); + aFName = comphelper::string::strip(aFName, ' '); if( aFontName.Len() ) aFontName += ';'; aFontName += aFName; @@ -486,15 +488,13 @@ sal_Bool OHTMLReader::CreateTable(int nToken) case HTML_TABLEDATA_OFF: case HTML_TABLEHEADER_OFF: { - aColumnName.EraseLeadingChars(); - aColumnName.EraseTrailingChars(); + aColumnName = comphelper::string::strip(aColumnName, ' ' ); if (!aColumnName.Len() || m_bAppendFirstLine ) aColumnName = String(ModuleRes(STR_COLUMN_NAME)); else if ( m_sCurrent.Len() ) aColumnName = m_sCurrent; - aColumnName.EraseLeadingChars(); - aColumnName.EraseTrailingChars(); + aColumnName = comphelper::string::strip(aColumnName, ' '); CreateDefaultColumn(aColumnName); aColumnName.Erase(); m_sCurrent.Erase(); @@ -510,8 +510,7 @@ sal_Bool OHTMLReader::CreateTable(int nToken) break; case HTML_TITLE_OFF: case HTML_CAPTION_OFF: - aTableName.EraseLeadingChars(); - aTableName.EraseTrailingChars(); + aTableName = comphelper::string::strip(aTableName, ' '); if(!aTableName.Len()) aTableName = String(::dbtools::createUniqueName(m_xTables,::rtl::OUString(aTableName))); else @@ -539,8 +538,7 @@ sal_Bool OHTMLReader::CreateTable(int nToken) if ( m_sCurrent.Len() ) aColumnName = m_sCurrent; - aColumnName.EraseLeadingChars(); - aColumnName.EraseTrailingChars(); + aColumnName = comphelper::string::strip(aColumnName, ' '); if(aColumnName.Len()) CreateDefaultColumn(aColumnName); diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx index 2ef4ccb86c36..4534c9528156 100644 --- a/dbaccess/source/ui/misc/RtfReader.cxx +++ b/dbaccess/source/ui/misc/RtfReader.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include "WExtendPages.hxx" #include "moduledbu.hxx" @@ -301,8 +302,7 @@ sal_Bool ORTFReader::CreateTable(int nToken) break; case RTF_CELL: { - aColumnName.EraseLeadingChars(); - aColumnName.EraseTrailingChars(); + aColumnName = comphelper::string::strip(aColumnName, ' '); if (!aColumnName.Len() || m_bAppendFirstLine ) aColumnName = String(ModuleRes(STR_COLUMN_NAME)); diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 6b91252feb56..902bd0aec8bb 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -957,8 +957,7 @@ namespace } { - String sTemp(aWorkStr); - sTemp.EraseTrailingChars( ',' ); + String sTemp(comphelper::string::stripEnd(aWorkStr, ',')); aWorkStr = sTemp; } @@ -2260,7 +2259,7 @@ namespace { aInfo->SetFunctionType(nFunctionType|FKT_AGGREGATE); String aCol(aColumns); - aInfo->SetFunction(aCol.GetToken(0,'(').EraseTrailingChars(' ')); + aInfo->SetFunction(comphelper::string::stripEnd(aCol.GetToken(0,'('), ' ')); } else aInfo->SetFunctionType(nFunctionType|FKT_OTHER); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 39ed8c602eed..ae2078cc6957 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1098,9 +1098,8 @@ sal_Bool OSelectionBrowseBox::SaveModified() break; sal_uInt16 nIdx = sal_uInt16(nRow - BROW_CRIT1_ROW); - String aText = m_pTextCell->GetText(); + String aText = comphelper::string::stripStart(m_pTextCell->GetText(), ' '); - aText.EraseLeadingChars(); ::rtl::OUString aCrit; if(aText.Len()) { -- cgit