diff options
76 files changed, 371 insertions, 321 deletions
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx index a5e032f3873a..882351e68502 100644 --- a/automation/source/server/statemnt.cxx +++ b/automation/source/server/statemnt.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <comphelper/uieventslogger.hxx> #include <tools/wintypes.hxx> @@ -817,7 +818,7 @@ void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Boo case WINDOW_BUTTONDIALOG: case WINDOW_MENUBARWINDOW: - aName = pBase->GetText().EraseAllChars('~'); + aName = comphelper::string::remove(pBase->GetText(), '~'); break; case WINDOW_EDIT: diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx index 0c066a2c0f76..cb26ae3e44f6 100644 --- a/basctl/source/basicide/brkdlg.cxx +++ b/basctl/source/basicide/brkdlg.cxx @@ -39,20 +39,21 @@ #include <basidesh.hxx> #include <basidesh.hrc> #include <iderdll.hxx> +#include <comphelper/string.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> // FIXME Why does BreakPointDialog allow only sal_uInt16 for break-point line // numbers, whereas BreakPoint supports sal_uLong? -bool lcl_ParseText( String aText, size_t& rLineNr ) +bool lcl_ParseText( const String &rText, size_t& rLineNr ) { // aText should look like "# n" where // n > 0 && n < std::numeric_limits< sal_uInt16 >::max(). // All spaces are ignored, so there can even be spaces within the // number n. (Maybe it would be better to ignore all whitespace instead // of just spaces.) - aText.EraseAllChars(' '); + String aText = comphelper::string::remove(rText, ' '); sal_Unicode cFirst = aText.GetChar(0); if (cFirst != '#' && !(cFirst >= '0' && cFirst <= '9')) return false; diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index 9eb83c8b503d..72f3ab0cd5e3 100644 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -1028,11 +1028,13 @@ sal_Bool BasicFrame::CompileAll() } // Setup menu -#define MENU2FILENAME( Name ) Name.Copy( Name.SearchAscii(" ") +1).EraseAllChars( '~' ) +#define MENU2FILENAME( Name ) comphelper::string::remove(Name.Copy(Name.SearchAscii(" ")+1), '~') + #define LRUNr( nNr ) \ rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("LRU")) \ .append(static_cast<sal_Int32>(nNr)) \ .makeStringAndClear() + String FILENAME2MENU( sal_uInt16 nNr, String aName ) { String aRet; @@ -1536,8 +1538,7 @@ long BasicFrame::Command( short nID, sal_Bool bChecked ) { MenuBar* pMenu = GetMenuBar(); PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); - String aName = pWinMenu->GetItemText( nID ); - aName.EraseAllChars( L'~' ); + rtl::OUString aName = comphelper::string::remove(pWinMenu->GetItemText(nID), '~'); AppWin* pWin = FindWin( aName ); if ( pWin ) pWin->ToTop(); diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx index b50aeee5b117..7cfde2d51fcb 100644 --- a/basic/source/app/status.cxx +++ b/basic/source/app/status.cxx @@ -34,6 +34,7 @@ #include "appwin.hxx" #include "status.hxx" +#include <comphelper/string.hxx> #include <vcl/decoview.hxx> StatusLine::StatusLine( BasicFrame* p ) @@ -82,7 +83,7 @@ IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB ) nFirstWinPos += pTTB->GetItemPos( pTTB->GetCurItemId() ) / 2; - AppWin* pWin = pFrame->FindWin( pWinMenu->GetItemText( pWinMenu->GetItemId( nFirstWinPos ) ).EraseAllChars( L'~' ) ); + AppWin* pWin = pFrame->FindWin(comphelper::string::remove(pWinMenu->GetItemText(pWinMenu->GetItemId(nFirstWinPos)), '~')); if ( pWin ) { pWin->Minimize( sal_False ); diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 2123d940fd34..c67638839588 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -48,6 +48,7 @@ #include <tools/wldcrd.hxx> #include <i18npool/lang.h> #include <rtl/string.hxx> +#include <rtl/strbuf.hxx> #include "runtime.hxx" #include "sbunoobj.hxx" @@ -81,6 +82,8 @@ using namespace com::sun::star::io; using namespace com::sun::star::script; using namespace com::sun::star::frame; +#include <comphelper/string.hxx> + #include "stdobj.hxx" #include <basic/sbstdobj.hxx> #include "rtlproto.hxx" @@ -124,10 +127,22 @@ Reference< XModel > getDocumentModel( StarBASIC* ); static void FilterWhiteSpace( String& rStr ) { - rStr.EraseAllChars( ' ' ); - rStr.EraseAllChars( '\t' ); - rStr.EraseAllChars( '\n' ); - rStr.EraseAllChars( '\r' ); + if (!rStr.Len()) + return; + + rtl::OUStringBuffer aRet(rStr); + + for (xub_StrLen i = 0; i < rStr.Len(); ++i) + { + sal_Unicode cChar = rStr.GetChar(i); + if ((cChar != ' ') && (cChar != '\t') && + (cChar != '\n') && (cChar != '\r')) + { + aRet.append(cChar); + } + } + + rStr = aRet.makeStringAndClear(); } static long GetDayDiff( const Date& rDate ) diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 584838ad6446..eb69a8479703 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -39,18 +39,19 @@ #include "flat/EColumns.hxx" #include <osl/thread.h> #include <tools/config.hxx> -#include <comphelper/sequence.hxx> #include <svl/zforlist.hxx> #include <rtl/math.hxx> #include <stdio.h> //sprintf #include <comphelper/extract.hxx> #include <comphelper/numbers.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/string.hxx> +#include <comphelper/types.hxx> #include "flat/EDriver.hxx" #include <com/sun/star/util/NumberFormat.hpp> #include <unotools/configmgr.hxx> #include <i18npool/mslangid.hxx> #include "connectivity/dbconversion.hxx" -#include <comphelper/types.hxx> #include "file/quotedstring.hxx" #include <unotools/syslocale.hxx> #include <rtl/logfile.hxx> @@ -713,9 +714,10 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal } // if ( DataType::INTEGER != nType ) else { - aStrConverted = aStr; if ( cThousandDelimiter ) - aStrConverted.EraseAllChars(cThousandDelimiter); + aStrConverted = comphelper::string::remove(aStr, cThousandDelimiter); + else + aStrConverted = aStr; } const double nVal = ::rtl::math::stringToDouble(aStrConverted,'.',',',NULL,NULL); diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index a8599630077e..6c91c3e3852b 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -34,6 +34,7 @@ #include <svl/eitem.hxx> #include <com/sun/star/frame/XStorable.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/intlwrapper.hxx> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> @@ -68,11 +69,9 @@ static String getNormDicEntry_Impl( const String &rText ) { String aTmp( rText ); aTmp.EraseTrailingChars( '.' ); - aTmp.EraseAllChars( '=' ); - return aTmp; + return comphelper::string::remove(aTmp, '='); } - // Compare Dictionary Entry result enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT }; diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 3d2fdb460a66..8978dc1d0998 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -52,6 +52,7 @@ #include <svtools/accessibilityoptions.hxx> #include <unotools/configitem.hxx> #include <sfx2/objsh.hxx> +#include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <svl/ctloptions.hxx> #include <svtools/langtab.hxx> @@ -775,7 +776,7 @@ OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) : String sLabel(aAAPointLimitLabel.GetText()); aMnemonicGenerator.RegisterMnemonic( sLabel ); aMnemonicGenerator.CreateMnemonic( sLabel ); - sLabel.EraseAllChars('~'); + sLabel = comphelper::string::remove(sLabel, '~'); sal_Int32 nLabelWidth = aAAPointLimitLabel.GetTextWidth( sLabel ); nLabelWidth += 3; // small gap diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx index 75fbb3933b3d..9300bede634a 100644 --- a/cui/source/options/optgenrl.cxx +++ b/cui/source/options/optgenrl.cxx @@ -27,6 +27,7 @@ ************************************************************************/ // include --------------------------------------------------------------- +#include <comphelper/string.hxx> #include <tools/shl.hxx> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> @@ -217,8 +218,8 @@ SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSe sName = sText; else sName = sText.GetToken( nIndex, '/' ); - sName.EraseAllChars( '(' ); - sName.EraseAllChars( ')' ); + sName = comphelper::string::remove(sName, '('); + sName = comphelper::string::remove(sName, ')'); if ( sName.Len() > 0 ) (*pCurrent)->SetAccessibleName( sName ); } diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx index e20ca59c5494..93b3df5c4f0b 100644 --- a/dbaccess/source/ui/querydesign/QTableWindow.cxx +++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx @@ -47,8 +47,9 @@ #include <com/sun/star/sdbcx/KeyType.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include "TableFieldInfo.hxx" -#include <comphelper/uno3.hxx> #include <comphelper/extract.hxx> +#include <comphelper/string.hxx> +#include <comphelper/uno3.hxx> #include "UITools.hxx" @@ -117,7 +118,7 @@ sal_Bool OQueryTableWindow::Init() } - sAliasName = String(sAliasName).EraseAllChars('"'); + sAliasName = comphelper::string::remove(sAliasName, '"'); SetAliasName(sAliasName); // SetAliasName reicht das als WinName weiter, dadurch benutzt es die Basisklasse // reset the title diff --git a/formula/Library_forui.mk b/formula/Library_forui.mk index 83fea2e756db..89716f31f392 100644 --- a/formula/Library_forui.mk +++ b/formula/Library_forui.mk @@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_api,forui,\ )) $(eval $(call gb_Library_add_linked_libs,forui,\ + comphelper \ cppu \ cppuhelper \ for \ diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 3b7c2eca142e..03673d6503d5 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -72,6 +72,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <boost/bind.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <map> #define TOKEN_OPEN 0 @@ -640,7 +641,7 @@ sal_Bool FormulaDlg_Impl::CalcStruct( const String& rStrExp) aString.Erase((xub_StrLen)(nLength-1)); } - aString.EraseAllChars('\n'); + aString = comphelper::string::remove(aString, '\n'); String aStrResult; if ( CalcValue(aString, aStrResult ) ) diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 94d59256f127..ae6c21ed8657 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -29,6 +29,8 @@ #ifndef _EXPORT_HXX #define _EXPORT_HXX +#include <comphelper/string.hxx> + #ifndef L10NTOOLS_DIRECTORY_HXX #define L10NTOOLS_DIRECTORY_HXX #include <l10ntools/directory.hxx> @@ -218,9 +220,10 @@ public: pPairedList( NULL ), sPForm( rPF ) { - sGId.EraseAllChars( '\r' ); - sPForm.EraseAllChars( '\r' ); + sGId = comphelper::string::remove(sGId, '\r'); + sPForm = comphelper::string::remove(sPForm, '\r'); }; + ResData( const ByteString &rPF, const ByteString &rGId , const ByteString &rFilename ) : nChildIndex( 0 ), @@ -246,13 +249,10 @@ public: pFilterList( NULL ), pPairedList( NULL ), sPForm( rPF ) - { - sGId.EraseAllChars( '\r' ); - sPForm.EraseAllChars( '\r' ); + sGId = comphelper::string::remove(sGId, '\r'); + sPForm = comphelper::string::remove(sPForm, '\r'); }; - - }; diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index 6922df968c6f..7ad52f670b9b 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -510,13 +510,14 @@ int Export::Execute( int nToken, const char * pToken ) ByteString sOrig( sToken ); sal_Bool bWriteToMerged = bMergeMode; - if ( nToken == CONDITION ) { - ByteString sTestToken( pToken ); - sTestToken.EraseAllChars( '\t' ); - sTestToken.EraseAllChars( ' ' ); - if (( !bReadOver ) && ( sTestToken.Search( "#ifndef__RSC_PARSER" ) == 0 )) + if ( nToken == CONDITION ) + { + rtl::OString sTestToken(pToken); + sTestToken = comphelper::string::remove(sTestToken, '\t'); + sTestToken = comphelper::string::remove(sTestToken, ' '); + if (( !bReadOver ) && ( comphelper::string::indexOfL(sTestToken, RTL_CONSTASCII_STRINGPARAM("#ifndef__RSC_PARSER")) == 0 )) bReadOver = sal_True; - else if (( bReadOver ) && ( sTestToken.Search( "#endif" ) == 0 )) + else if (( bReadOver ) && ( comphelper::string::indexOfL(sTestToken, RTL_CONSTASCII_STRINGPARAM("#endif")) == 0 )) bReadOver = sal_False; } if ((( nToken < FILTER_LEVEL ) || ( bReadOver )) && @@ -638,16 +639,17 @@ int Export::Execute( int nToken, const char * pToken ) pResData = new ResData( sActPForm, FullId() , sFilename ); aResStack.push_back( pResData ); ByteString sBackup( sToken ); - sToken.EraseAllChars( '\n' ); - sToken.EraseAllChars( '\r' ); - sToken.EraseAllChars( '{' ); + sToken = comphelper::string::remove(sToken, '\n'); + sToken = comphelper::string::remove(sToken, '\r'); + sToken = comphelper::string::remove(sToken, '{'); while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {}; sToken.EraseTrailingChars( ' ' ); ByteString sT = getToken(sToken, 0, ' '); pResData->sResTyp = sT.ToLowerAscii(); ByteString sId( sToken.Copy( pResData->sResTyp.Len() + 1 )); ByteString sCondition; - if ( sId.Search( "#" ) != STRING_NOTFOUND ) { + if ( sId.Search( "#" ) != STRING_NOTFOUND ) + { // between ResTyp, Id and paranthes is a precomp. condition sCondition = "#"; sCondition += ByteString(getToken(sId, 1, '#')); @@ -655,7 +657,7 @@ int Export::Execute( int nToken, const char * pToken ) } sId = getToken(sId, 0, '/'); CleanValue( sId ); - sId = sId.EraseAllChars( '\t' ); + sId = comphelper::string::remove(sId, '\t'); pResData->SetId( sId, ID_LEVEL_IDENTIFIER ); if ( sCondition.Len()) { @@ -676,12 +678,12 @@ int Export::Execute( int nToken, const char * pToken ) pResData = new ResData( sActPForm, FullId() , sFilename ); aResStack.push_back( pResData ); - sToken.EraseAllChars( '\n' ); - sToken.EraseAllChars( '\r' ); - sToken.EraseAllChars( '{' ); - sToken.EraseAllChars( '\t' ); - sToken.EraseAllChars( ' ' ); - sToken.EraseAllChars( '\\' ); + sToken = comphelper::string::remove(sToken, '\n'); + sToken = comphelper::string::remove(sToken, '\r'); + sToken = comphelper::string::remove(sToken, '{'); + sToken = comphelper::string::remove(sToken, '\t'); + sToken = comphelper::string::remove(sToken, ' '); + sToken = comphelper::string::remove(sToken, '\\'); pResData->sResTyp = sToken.ToLowerAscii(); } break; @@ -736,36 +738,44 @@ int Export::Execute( int nToken, const char * pToken ) } } break; - case ASSIGNMENT: { + case ASSIGNMENT: + { bDontWriteOutput = sal_False; // interpret different types of assignement - ByteString sKey = getToken(sToken, 0, '='); - sKey.EraseAllChars( ' ' ); - sKey.EraseAllChars( '\t' ); + rtl::OString sKey = getToken(sToken, 0, '='); + sKey = comphelper::string::remove(sKey, ' '); + sKey = comphelper::string::remove(sKey, '\t'); ByteString sValue = getToken(sToken, 1, '='); CleanValue( sValue ); - if ( sKey.ToUpperAscii() == "IDENTIFIER" ) { - ByteString sId( sValue.EraseAllChars( '\t' )); - pResData->SetId( sId.EraseAllChars( ' ' ), ID_LEVEL_IDENTIFIER ); + sKey = sKey.toAsciiUpperCase(); + if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("IDENTIFIER"))) + { + ByteString sId(comphelper::string::remove(sValue, '\t')); + sId = comphelper::string::remove(sId, ' '); + pResData->SetId(sId, ID_LEVEL_IDENTIFIER); } - else if ( sKey == "HELPID" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("HELPID"))) + { pResData->sHelpId = sValue; } - else if ( sKey == "STRINGLIST" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("STRINGLIST"))) + { pResData->bList = sal_True; nList = LIST_STRING; m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } - else if ( sKey == "FILTERLIST" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("FILTERLIST"))) + { pResData->bList = sal_True; nList = LIST_FILTER; m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } - else if ( sKey == "UIENTRIES" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("UIENTRIES"))) + { pResData->bList = sal_True; nList = LIST_UIENTRIES; m_sListLang = SOURCE_LANGUAGE; @@ -780,26 +790,29 @@ int Export::Execute( int nToken, const char * pToken ) } break; case UIENTRIES: - case LISTASSIGNMENT: { + case LISTASSIGNMENT: + { bDontWriteOutput = sal_False; - ByteString sTmpToken( sToken); - sTmpToken.EraseAllChars(' '); + ByteString sTmpToken(comphelper::string::remove(sToken, ' ')); sal_uInt16 nPos = 0; nPos = sTmpToken.ToLowerAscii().Search("[en-us]="); if( nPos != STRING_NOTFOUND ) { - ByteString sKey = sTmpToken.Copy( 0 , nPos ); - sKey.EraseAllChars( ' ' ); - sKey.EraseAllChars( '\t' ); + rtl::OString sKey = sTmpToken.Copy( 0 , nPos ); + sKey = comphelper::string::remove(sKey, ' '); + sKey = comphelper::string::remove(sKey, '\t'); ByteString sValue = getToken(sToken, 1, '='); CleanValue( sValue ); - if ( sKey.ToUpperAscii() == "STRINGLIST" ) { + sKey = sKey.toAsciiUpperCase(); + if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("STRINGLIST"))) + { pResData->bList = sal_True; nList = LIST_STRING; m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } - else if ( sKey == "FILTERLIST" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("FILTERLIST"))) + { pResData->bList = sal_True; nList = LIST_FILTER; m_sListLang = SOURCE_LANGUAGE; @@ -807,22 +820,24 @@ int Export::Execute( int nToken, const char * pToken ) nListLevel = 0; } // PairedList - else if ( sKey == "PAIREDLIST" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("PAIREDLIST"))) + { pResData->bList = sal_True; nList = LIST_PAIRED; m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } - - else if ( sKey == "ITEMLIST" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("ITEMLIST"))) + { pResData->bList = sal_True; nList = LIST_ITEM; m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } - else if ( sKey == "UIENTRIES" ) { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("UIENTRIES"))) + { pResData->bList = sal_True; nList = LIST_UIENTRIES; m_sListLang = SOURCE_LANGUAGE; @@ -830,20 +845,22 @@ int Export::Execute( int nToken, const char * pToken ) nListLevel = 0; } } - else { + else + { // new res. is a String- or FilterList - ByteString sKey = getToken(sToken, 0, '['); - sKey.EraseAllChars( ' ' ); - sKey.EraseAllChars( '\t' ); - if ( sKey.ToUpperAscii() == "STRINGLIST" ) + rtl::OString sKey = getToken(sToken, 0, '['); + sKey = comphelper::string::remove(sKey, ' '); + sKey = comphelper::string::remove(sKey, '\t'); + sKey = sKey.toAsciiUpperCase(); + if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("STRINGLIST"))) nList = LIST_STRING; - else if ( sKey == "FILTERLIST" ) + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("FILTERLIST"))) nList = LIST_FILTER; - else if ( sKey == "PAIREDLIST" ) + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("PAIREDLIST"))) nList = LIST_PAIRED; // abcd - else if ( sKey == "ITEMLIST" ) + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("ITEMLIST"))) nList = LIST_ITEM; - else if ( sKey == "UIENTRIES" ) + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("UIENTRIES"))) nList = LIST_UIENTRIES; if ( nList ) { ByteString sLang = getToken(getToken(sToken, 1, '['), 0, ']'); @@ -877,13 +894,14 @@ int Export::Execute( int nToken, const char * pToken ) case LONGTEXTLINE: case TEXTLINE: bDontWriteOutput = sal_False; - if ( nLevel ) { + if ( nLevel ) + { CutComment( sToken ); // this is a text line!!! - ByteString sKey = getToken(getToken(sToken, 0, '='), 0, '['); - sKey.EraseAllChars( ' ' ); - sKey.EraseAllChars( '\t' ); + rtl::OString sKey = getToken(getToken(sToken, 0, '='), 0, '['); + sKey = comphelper::string::remove(sKey, ' '); + sKey = comphelper::string::remove(sKey, '\t'); ByteString sText( GetText( sToken, nToken )); ByteString sLang; if ( getToken(sToken, 0, '=').indexOf('[') != -1 ) @@ -893,12 +911,14 @@ int Export::Execute( int nToken, const char * pToken ) } rtl::OString sLangIndex = sLang; ByteString sOrigKey = sKey; - if ( sText.Len() && sLang.Len() ) { - if (( sKey.ToUpperAscii() == "TEXT" ) || - ( sKey == "MESSAGE" ) || - ( sKey == "CUSTOMUNITTEXT" ) || - ( sKey == "SLOTNAME" ) || - ( sKey == "UINAME" )) + if ( sText.Len() && sLang.Len() ) + { + sKey = sKey.toAsciiUpperCase(); + if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("TEXT")) || + sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("MESSAGE")) || + sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("CUSTOMUNITTEXT")) || + sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("SLOTNAME")) || + sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("UINAME"))) { SetChildWithText(); if ( Export::isSourceLanguage( sLangIndex ) ) @@ -997,22 +1017,19 @@ int Export::Execute( int nToken, const char * pToken ) bDontWriteOutput = sal_False; // this is a AppfontMapping, so look if its a definition // of field size - ByteString sKey = getToken(sToken, 0, '='); - sKey.EraseAllChars( ' ' ); - sKey.EraseAllChars( '\t' ); + rtl::OString sKey = getToken(sToken, 0, '='); + sKey = comphelper::string::remove(sKey, ' '); + sKey = comphelper::string::remove(sKey, '\t'); rtl::OString sMapping = getToken(sToken, 1, '='); sMapping = getToken(sMapping, 1, '('); sMapping = getToken(sMapping, 0, ')'); sMapping = replace(sMapping, rtl::OString(' '), rtl::OString()); sMapping = replace(sMapping, rtl::OString('\t'), rtl::OString()); - if ( sKey.ToUpperAscii() == "SIZE" ) - { + sKey = sKey.toAsciiUpperCase(); + if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("SIZE"))) pResData->nWidth = ( sal_uInt16 ) getToken(sMapping, 0, ',').toInt32(); - } - else if ( sKey == "POSSIZE" ) - { + else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("POSSIZE"))) pResData->nWidth = ( sal_uInt16 ) getToken(sMapping, 2, ',').toInt32(); - } } break; case RSCDEFINELEND: @@ -1492,13 +1509,15 @@ ByteString Export::GetText( const ByteString &rSource, int nToken ) #define TXT_STATE_MACRO 0x002 { ByteString sReturn; - switch ( nToken ) { + switch ( nToken ) + { case TEXTLINE: - case LONGTEXTLINE: { + case LONGTEXTLINE: + { ByteString sTmp( rSource.Copy( rSource.Search( "=" ))); CleanValue( sTmp ); - sTmp.EraseAllChars( '\n' ); - sTmp.EraseAllChars( '\r' ); + sTmp = comphelper::string::remove(sTmp, '\n'); + sTmp = comphelper::string::remove(sTmp, '\r'); while ( sTmp.SearchAndReplace( "\\\\\"", "-=<[BSlashBSlashHKom]>=-\"" ) != STRING_NOTFOUND ) {}; diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 957ecc26879e..166d35598cfe 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_l10ntools.hxx" +#include <comphelper/string.hxx> #include <stdio.h> #include <tools/string.hxx> #include <tools/fsys.hxx> @@ -582,37 +583,40 @@ void XRMResExport::EndOfText( (void) rOpenTag; // FIXME (void) rCloseTag; // FIXME - if ( pResData && pOutputStream ) { + if ( pResData && pOutputStream ) + { ByteString sTimeStamp( Export::GetTimeStamp()); ByteString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + for( unsigned int n = 0; n < aLanguages.size(); n++ ) + { sCur = aLanguages[ n ]; - ByteString sAct = pResData->sText[ sCur ]; - sAct.EraseAllChars( 0x0A ); - - ByteString sOutput( sPrj ); sOutput += "\t"; - sOutput += sPath; - sOutput += "\t0\t"; - sOutput += sResourceType; - sOutput += "\t"; - sOutput += pResData->sId; - // USE LID AS GID OR MERGE DON'T WORK - //sOutput += pResData->sGId; - sOutput += "\t"; - sOutput += pResData->sId; - sOutput += "\t\t\t0\t"; - sOutput += sCur; - sOutput += "\t"; - - sOutput += sAct; sOutput += "\t\t\t\t"; - sOutput += sTimeStamp; - - sal_Char cSearch = 0x00; - sOutput.SearchAndReplaceAll( cSearch, '_' ); - if( sAct.Len() > 1 ) - pOutputStream->WriteLine( sOutput ); - } + rtl::OString sAct = pResData->sText[ sCur ]; + sAct = comphelper::string::remove(sAct, 0x0A); + + ByteString sOutput( sPrj ); sOutput += "\t"; + sOutput += sPath; + sOutput += "\t0\t"; + sOutput += sResourceType; + sOutput += "\t"; + sOutput += pResData->sId; + // USE LID AS GID OR MERGE DON'T WORK + //sOutput += pResData->sGId; + sOutput += "\t"; + sOutput += pResData->sId; + sOutput += "\t\t\t0\t"; + sOutput += sCur; + sOutput += "\t"; + + sOutput += sAct; + sOutput += "\t\t\t\t"; + sOutput += sTimeStamp; + + sal_Char cSearch = 0x00; + sOutput.SearchAndReplaceAll( cSearch, '_' ); + if( sAct.getLength() > 1 ) + pOutputStream->WriteLine( sOutput ); + } } delete pResData; pResData = NULL; diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx index 681f2ada74ab..7c8ba798369d 100644 --- a/linguistic/source/spelldta.cxx +++ b/linguistic/source/spelldta.cxx @@ -29,9 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_linguistic.hxx" #include <com/sun/star/uno/Reference.h> - #include <com/sun/star/linguistic2/SpellFailure.hpp> #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp> +#include <comphelper/string.hxx> #include <tools/debug.hxx> #include <osl/mutex.hxx> @@ -107,9 +107,8 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage, String aEntryTxt; if (pEntries[k].is()) { - aEntryTxt = pEntries[k]->getDictionaryWord(); // remove characters used to determine hyphenation positions - aEntryTxt.EraseAllChars( '=' ); + aEntryTxt = comphelper::string::remove(pEntries[k]->getDictionaryWord(), '='); } if (aEntryTxt.Len() > 0 && LevDistance( rText, aEntryTxt ) <= 2) rDicListProps.push_back( aEntryTxt ); diff --git a/linguistic/workben/makefile.mk b/linguistic/workben/makefile.mk index 6c04929d7b73..9df85c75140b 100755 --- a/linguistic/workben/makefile.mk +++ b/linguistic/workben/makefile.mk @@ -75,6 +75,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX) SHL1STDLIBS= \ + $(COMPHELPERLIB) \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(TOOLSLIB) \ diff --git a/linguistic/workben/sspellimp.cxx b/linguistic/workben/sspellimp.cxx index d051bd3ee9c9..bf0c8a07edb0 100644 --- a/linguistic/workben/sspellimp.cxx +++ b/linguistic/workben/sspellimp.cxx @@ -30,10 +30,10 @@ #include "precompiled_linguistic.hxx" #include <com/sun/star/uno/Reference.h> #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp> - #include <com/sun/star/linguistic2/SpellFailure.hpp> -#include <cppuhelper/factory.hxx> // helper for factories #include <com/sun/star/registry/XRegistryKey.hpp> +#include <comphelper/string.hxx> +#include <cppuhelper/factory.hxx> // helper for factories #include <tools/debug.hxx> #include <osl/mutex.hxx> @@ -242,8 +242,8 @@ Reference< XSpellAlternatives > aAlt2( aTmp ); aAlt1.SearchAndReplaceAll( (sal_Unicode) 'x', (sal_Unicode) 'u'); aAlt1.SearchAndReplaceAll( (sal_Unicode) 'X', (sal_Unicode) 'U'); - aAlt2.EraseAllChars( (sal_Unicode) 'x' ); - aAlt2.EraseAllChars( (sal_Unicode) 'X' ); + aAlt2 = comphelper::string::remove(aAlt2, 'x'); + aAlt2 = comphelper::string::remove(aAlt2, 'X'); pStr[0] = aAlt1; pStr[1] = aAlt2; diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx index 24fac69a4a87..b9969de123fa 100644 --- a/rsc/source/rsc/rsc.cxx +++ b/rsc/source/rsc/rsc.cxx @@ -1198,7 +1198,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, aLine.EraseLeadingChars( ' ' ); aLine.EraseLeadingChars( '\t' ); - aLine.EraseAllChars( ';' ); + aLine = comphelper::string::remove(aLine, ';'); if (comphelper::string::isdigitAsciiString(aLine)) { diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index fd517a37310d..41e7c27d0a8c 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -36,6 +36,7 @@ // INCLUDE --------------------------------------------------------------- #include "scitems.hxx" +#include <comphelper/string.hxx> #include <editeng/eeitem.hxx> #include <svx/algitem.hxx> @@ -72,8 +73,8 @@ const sal_Char ScEditUtil::pCalcDelimiters[] = "=()+-*/^&<>"; String ScEditUtil::ModifyDelimiters( const String& rOld ) { - String aRet = rOld; - aRet.EraseAllChars( '_' ); // underscore is used in function argument names + // underscore is used in function argument names + String aRet = comphelper::string::remove(rOld, '_'); aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( pCalcDelimiters ) ); aRet.Append(ScCompiler::GetNativeSymbol(ocSep)); // argument separator is localized. return aRet; diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 733e06918437..bb9805263c03 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -37,10 +37,11 @@ #include <tools/urlobj.hxx> #include <svl/converter.hxx> #include <svl/zforlist.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <ucbhelper/content.hxx> #include <unotools/sharedunocomponent.hxx> -#include <comphelper/processfactory.hxx> #include <svx/txenctab.hxx> #include <svx/dbcharsethelper.hxx> @@ -539,7 +540,7 @@ void lcl_GetColumnTypes( ScDocShell& rDocShell, if ( nToken > 1 ) { aFieldName = aString.GetToken( 0, ',' ); - aString.EraseAllChars( ' ' ); + aString = comphelper::string::remove(aString, ' '); switch ( aString.GetToken( 1, ',' ).GetChar(0) ) { case 'L' : diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 69585be38e1d..756c51254eef 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +#include <comphelper/string.hxx> #include <svl/undo.hxx> #include <unotools/textsearch.hxx> #include <unotools/localedatawrapper.hxx> @@ -339,8 +340,7 @@ bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction) String aString; String aDesc; - String aComment=pScChangeAction->GetComment(); - aComment.EraseAllChars('\n'); + String aComment = comphelper::string::remove(pScChangeAction->GetComment(), '\n'); if(eType==SC_CAT_CONTENT) { @@ -465,8 +465,8 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeAction( bIsGenerated = true; } - String aComment=pScChangeAction->GetComment(); - aComment.EraseAllChars('\n'); + String aComment = comphelper::string::remove(pScChangeAction->GetComment(), '\n'); + if(aDesc.Len()>0) { aComment.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" )); @@ -637,8 +637,8 @@ SvLBoxEntry* ScAcceptChgDlg::InsertFilteredAction( aString+='\t'; } - String aComment=pScChangeAction->GetComment(); - aComment.EraseAllChars('\n'); + String aComment = comphelper::string::remove(pScChangeAction->GetComment(), '\n'); + if(aDesc.Len()>0) { aComment.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" )); @@ -747,8 +747,8 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionConte aString+='\t'; aString+='\t'; } - String aComment=pScChangeAction->GetComment(); - aComment.EraseAllChars('\n'); + + String aComment = comphelper::string::remove(pScChangeAction->GetComment(), '\n'); if(aDesc.Len()>0) { diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index e298de18c479..b5dfe5c2a0eb 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -56,9 +56,10 @@ #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> #include <comphelper/processfactory.hxx> -#include <comphelper/types.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/stillreadwriteinteraction.hxx> +#include <comphelper/string.hxx> +#include <comphelper/types.hxx> #include <tools/urlobj.hxx> #include <vcl/help.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -1368,12 +1369,12 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac { rpURLList = NULL; - String sExtension; + rtl::OUString sExtension; if (pFilter) { sExtension = pFilter->GetDefaultExtension (); - sExtension.EraseAllChars( '*' ); - sExtension.EraseAllChars( '.' ); + sExtension = comphelper::string::remove(sExtension, '*'); + sExtension = comphelper::string::remove(sExtension, '.'); } // a) the new way (optional!) diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 43fd007e688c..b7d387115e9a 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -1263,8 +1263,10 @@ namespace sfx2 { String sExt = _rExtension; if ( !_bForOpen ) + { // show '*' in extensions only when opening a document - sExt.EraseAllChars( '*' ); + sExt = comphelper::string::remove(sExt, '*'); + } sRet += sOpenBracket; sRet += sExt; sRet += sCloseBracket; diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index d662371bc329..42da4b80bea7 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -73,12 +73,13 @@ #include <ucbhelper/content.hxx> #include <tools/urlobj.hxx> #include <unotools/useroptions.hxx> -#include <comphelper/processfactory.hxx> #include <comphelper/extract.hxx> -#include <comphelper/storagehelper.hxx> -#include <comphelper/sequenceasvector.hxx> -#include <comphelper/sequenceashashmap.hxx> #include <comphelper/mediadescriptor.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <comphelper/sequenceasvector.hxx> +#include <comphelper/storagehelper.hxx> +#include <comphelper/string.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx> #include <cppuhelper/implbase1.hxx> @@ -992,15 +993,15 @@ sal_Bool CreateFromAddress_Impl( String& rFrom ) } rFrom += TRIM( aName ); // remove illegal characters - rFrom.EraseAllChars( '<' ); - rFrom.EraseAllChars( '>' ); - rFrom.EraseAllChars( '@' ); + rFrom = comphelper::string::remove(rFrom, '<'); + rFrom = comphelper::string::remove(rFrom, '>'); + rFrom = comphelper::string::remove(rFrom, '@'); } String aEmailName = aUserCFG.GetEmail(); // remove illegal characters - aEmailName.EraseAllChars( '<' ); - aEmailName.EraseAllChars( '>' ); + aEmailName = comphelper::string::remove(aEmailName, '<'); + aEmailName = comphelper::string::remove(aEmailName, '>'); if ( aEmailName.Len() ) { diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index 0984e8c62010..3cadcdfdd071 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -30,6 +30,8 @@ #include "precompiled_sfx2.hxx" // INCLUDE --------------------------------------------------------------- +#include <comphelper/string.hxx> + #include <svl/style.hxx> #include <sfx2/newstyle.hxx> @@ -65,7 +67,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl ) IMPL_LINK_INLINE_START( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) { - aOKBtn.Enable( pBox->GetText().EraseAllChars().Len() > 0 ); + aOKBtn.Enable( comphelper::string::remove(pBox->GetText(), ' ').getLength() > 0 ); return 0; } IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 990eb6ec7e1c..b03948b7f345 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -65,6 +65,7 @@ #include <svtools/ehdl.hxx> #include <unotools/printwarningoptions.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/script/DocumentDialogLibraryContainer.hpp> @@ -984,7 +985,8 @@ String SfxObjectShell::GetServiceNameFromFactory( const String& rFact ) aFact.Erase( nPos, aFact.Len() ); aParam.Erase(0,1); } - aFact.EraseAllChars('4').ToLowerAscii(); + aFact = comphelper::string::remove(aFact, '4'); + aFact.ToLowerAscii(); // HACK: sometimes a real document service name is given here instead of // a factory short name. Set return value directly to this service name as fallback diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 0daecc2054dd..e9eced85b334 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -32,6 +32,7 @@ #define SMDLL 1 #include "tools/rcid.h" +#include <comphelper/string.hxx> #include <svl/eitem.hxx> #include <svl/intitem.hxx> #include <svl/stritem.hxx> @@ -2267,8 +2268,7 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox, #endif // 'Normalisieren' des SymbolNamens (ohne Leerzeichen) - XubString aNormName (rSymbolName); - aNormName.EraseAllChars(' '); + XubString aNormName(comphelper::string::remove(rSymbolName, ' ')); // und evtl Abweichungen in der Eingabe beseitigen rComboBox.SetText(aNormName); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index a77a32a92e77..4d3ea9c6bd76 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -41,6 +41,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/string.hxx> #include <rtl/logfile.hxx> #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> @@ -1101,7 +1102,7 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M for (sal_uInt16 i = 0; i < nLines; i++) { aLine = rText.GetToken(i, '\n'); - aLine.EraseAllChars('\r'); + aLine = comphelper::string::remove(aLine, '\r'); aLine.EraseLeadingChars('\n'); aLine.EraseTrailingChars('\n'); @@ -1192,7 +1193,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const for (sal_uInt16 i = 0; i < nLines; i++) { aLine = rText.GetToken(i, '\n'); - aLine.EraseAllChars('\r'); + aLine = comphelper::string::remove(aLine, '\r'); aLine.EraseLeadingChars('\n'); aLine.EraseTrailingChars('\n'); aSize = GetTextLineSize(rDevice, aLine); diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index bb249be090a4..3fa6908b1d4f 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -33,6 +33,7 @@ #include <stdlib.h> #include <float.h> #include <errno.h> +#include <comphelper/string.hxx> #include <tools/date.hxx> #include <tools/debug.hxx> #include <rtl/math.hxx> @@ -2073,7 +2074,7 @@ bool ImpSvNumberInputScan::ScanStringNumFor( return false; const ::utl::TransliterationWrapper* pTransliteration = pFormatter->GetTransliteration(); const String* pStr; - String aString( rString ); + rtl::OUString aString( rString ); bool bFound = false; bool bFirst = true; bool bContinue = true; @@ -2100,7 +2101,7 @@ bool ImpSvNumberInputScan::ScanStringNumFor( if ( !bFound && bFirst && nPos ) { // try remaining substring bFirst = false; - aString.Erase( 0, nPos ); + aString = aString.copy(nPos); bContinue = true; } } while ( bContinue ); @@ -2110,8 +2111,8 @@ bool ImpSvNumberInputScan::ScanStringNumFor( if ( !bDontDetectNegation && (nString == 0) && !bFirst && (nSign < 0) && pFormat->IsNegativeRealNegative() ) { // simply negated twice? --1 - aString.EraseAllChars( ' ' ); - if ( (aString.Len() == 1) && (aString.GetChar(0) == '-') ) + aString = comphelper::string::remove(aString, ' '); + if ( (aString.getLength() == 1) && (aString[0] == '-') ) { bFound = true; nStringScanSign = -1; diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index a56abdc3b0dd..c4315d3a007d 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -33,6 +33,7 @@ #include <float.h> #include <errno.h> #include <stdlib.h> +#include <comphelper/string.hxx> #include <tools/debug.hxx> #include <osl/diagnose.h> #include <i18npool/mslangid.hxx> @@ -1358,7 +1359,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, case '>': case '=': { - sSymbol.EraseAllChars('['); + sSymbol = comphelper::string::remove(sSymbol, '['); sSymbol += cToken; cLetter = cToken; eState = SsGetCon; @@ -1382,7 +1383,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, { if ( rString.GetChar(nPos) == '-' ) { // [$-xxx] locale - sSymbol.EraseAllChars('['); + sSymbol = comphelper::string::remove(sSymbol, '['); eSymbolType = BRACKET_SYMBOLTYPE_LOCALE; eState = SsGetPrefix; } @@ -1412,7 +1413,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, sal_Unicode cDBNum = rString.GetChar( nPos-1+aDBNum.Len() ); if ( aUpperNatNum == aNatNum && 0 <= nNatNumNum && nNatNumNum <= 19 ) { - sSymbol.EraseAllChars('['); + sSymbol = comphelper::string::remove(sSymbol, '['); sSymbol += rString.Copy( --nPos, aNatNum.Len()+1 ); nPos += aNatNum.Len()+1; //! SymbolType is negative @@ -1421,7 +1422,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, } else if ( aUpperDBNum == aDBNum && '1' <= cDBNum && cDBNum <= '9' ) { - sSymbol.EraseAllChars('['); + sSymbol = comphelper::string::remove(sSymbol, '['); sSymbol += rString.Copy( --nPos, aDBNum.Len()+1 ); nPos += aDBNum.Len()+1; //! SymbolType is negative @@ -1439,7 +1440,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, } else { - sSymbol.EraseAllChars('['); + sSymbol = comphelper::string::remove(sSymbol, '['); sSymbol += cToken; eSymbolType = BRACKET_SYMBOLTYPE_COLOR; eState = SsGetPrefix; @@ -1479,14 +1480,14 @@ short SvNumberformat::ImpNextSymbol(String& rString, } else { - sSymbol.EraseAllChars('['); + sSymbol = comphelper::string::remove(sSymbol, '['); sSymbol += cToken; eState = SsGetPrefix; } } else { - sSymbol.EraseAllChars('['); + sSymbol = comphelper::string::remove(sSymbol, '['); sSymbol += cToken; eSymbolType = BRACKET_SYMBOLTYPE_COLOR; eState = SsGetPrefix; @@ -2674,7 +2675,8 @@ bool SvNumberformat::GetOutputString(double fNumber, } ExpStr = sStr.Copy( nExpStart ); // part following the "E+" sStr.Erase( nExPos ); - sStr.EraseAllChars('.'); // cut any decimal delimiter + // cut any decimal delimiter + sStr = comphelper::string::remove(sStr, '.'); if ( rInfo.nCntPre != 1 ) // rescale Exp { sal_Int32 nExp = ExpStr.ToInt32() * nExpSign; diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 7e114c3d06ac..80bfb2e8be88 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -32,6 +32,7 @@ #define UNICODE #include "ddeimp.hxx" #include <algorithm> +#include <comphelper/string.hxx> #include <svl/svdde.hxx> #include <svl/svarray.hxx> #include <tools/debug.hxx> @@ -133,7 +134,8 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( while( STRING_NOTFOUND != n ) { String s( sTopics.GetToken( 0, '\t', n )); - s.EraseAllChars( '\n' ).EraseAllChars( '\r' ); + s = comphelper::string::remove(s, '\n'); + s = comphelper::string::remove(s, '\r'); if( !hText1 || s == reinterpret_cast<const sal_Unicode*>(chTopicBuf) ) { DdeString aDStr( pInst->hDdeInstSvr, s ); diff --git a/svtools/bmpmaker/bmpcore.cxx b/svtools/bmpmaker/bmpcore.cxx index c6b13db704f0..d1e0964210d9 100644 --- a/svtools/bmpmaker/bmpcore.cxx +++ b/svtools/bmpmaker/bmpcore.cxx @@ -132,7 +132,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs, aLine.EraseLeadingChars( ' ' ); aLine.EraseLeadingChars( '\t' ); - aLine.EraseAllChars( ';' ); + aLine = comphelper::string::remove(aLine, ';'); if (comphelper::string::isdigitAsciiString(aLine)) { diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index dc736486ef9b..f7f29faa2864 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -33,6 +33,7 @@ #include <string.h> +#include <comphelper/string.hxx> #include <tools/debug.hxx> #include <i18npool/mslangid.hxx> #include <vcl/window.hxx> @@ -469,7 +470,7 @@ XubString FontList::GetStyleName( const FontInfo& rInfo ) const // Translate StyleName to localized name XubString aCompareStyleName = aStyleName; aCompareStyleName.ToLowerAscii(); - aCompareStyleName.EraseAllChars( ' ' ); + aCompareStyleName = comphelper::string::remove(aCompareStyleName, ' '); if ( aCompareStyleName.EqualsAscii( "bold" ) ) aStyleName = maBold; else if ( aCompareStyleName.EqualsAscii( "bolditalic" ) ) diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx index aa2899728fb4..4eab4c652f39 100644 --- a/svtools/source/filter/sgvtext.cxx +++ b/svtools/source/filter/sgvtext.cxx @@ -1266,8 +1266,7 @@ void SgfFontLst::ReadList() for (i=0;i<Anz;i++) { - FID = aCfg.GetKeyName( i ); - FID = FID.EraseAllChars(); // Leerzeichen weg + FID = comphelper::string::remove(aCfg.GetKeyName(i), ' '); Dsc = aCfg.ReadKey( i ); if (comphelper::string::isdigitAsciiString(FID)) { diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index 98b0ee3fa0fd..5b1d23d8cc53 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -267,7 +267,7 @@ void ImageMap::ImpReadCERNLine( const rtl::OString& rLine, const String& rBaseUR aStr.EraseLeadingChars( ' ' ); aStr.EraseLeadingChars( '\t' ); - aStr.EraseAllChars( ';' ); + aStr = comphelper::string::remove(aStr, ';'); aStr.ToLowerAscii(); const char* pStr = aStr.GetBuffer(); @@ -410,7 +410,7 @@ void ImageMap::ImpReadNCSALine( const rtl::OString& rLine, const String& rBaseUR aStr.EraseLeadingChars( ' ' ); aStr.EraseLeadingChars( '\t' ); - aStr.EraseAllChars( ';' ); + aStr = comphelper::string::remove(aStr, ';'); aStr.ToLowerAscii(); const char* pStr = aStr.GetBuffer(); diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 17f092d891af..eb976e541b74 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -31,6 +31,7 @@ #include <ctype.h> #include <stdio.h> +#include <comphelper/string.hxx> #include <tools/stream.hxx> #include <tools/debug.hxx> #include <tools/color.hxx> @@ -2121,8 +2122,8 @@ bool HTMLParser::ParseMetaOptionsImpl( if ( bHTTPEquiv || HTML_META_DESCRIPTION != nAction ) { // if it is not a Description, remove CRs and LFs from CONTENT - aContent.EraseAllChars( _CR ); - aContent.EraseAllChars( _LF ); + aContent = comphelper::string::remove(aContent, _CR); + aContent = comphelper::string::remove(aContent, _LF); } else { diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index c2171261a3ce..314865e8265e 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -42,6 +42,7 @@ #include "svx/layctrl.hxx" #include <svx/dialmgr.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <svtools/colorcfg.hxx> // namespaces @@ -673,9 +674,9 @@ void ColumnsWindow::Paint( const Rectangle& ) SetFillColor( aFaceColor ); String aText; if ( nCol ) - aText = String( String::CreateFromInt32(nCol) ); + aText = String::CreateFromInt32(nCol); else - aText = Button::GetStandardText( BUTTON_CANCEL ).EraseAllChars( '~' ); + aText = comphelper::string::remove(Button::GetStandardText(BUTTON_CANCEL), '~'); Size aTextSize(GetTextWidth( aText ), GetTextHeight()); DrawText( Point( ( aSize.Width() - aTextSize.Width() ) / 2, aSize.Height() - nTextHeight + 2 ), aText ); diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 281250494a4e..2c11ea3b74ba 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -31,6 +31,7 @@ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <svl/itemiter.hxx> #include <editeng/lrspitem.hxx> #include <editeng/adjitem.hxx> @@ -2108,7 +2109,7 @@ sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext ) String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(), *rAttr.GetEnd() - *rAttr.GetStart() ) ); - sTxt.EraseAllChars( 0x0a ); + sTxt = comphelper::string::remove(sTxt, 0x0a); sTxt.EraseLeadingChars().EraseTrailingChars(); if( sTxt.Len() ) diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 9a86bac7ea84..8f772ef6a8b9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -32,6 +32,8 @@ #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> +#include <comphelper/string.hxx> + #include <vcl/svapp.hxx> #include <vcl/window.hxx> @@ -671,8 +673,8 @@ String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam ) String aStr( pPam->GetTxt() ); String aSearchStr( rSearchOpt.searchString ); String aReplaceStr( rSearchOpt.replaceString ); - aStr.EraseAllChars( CH_TXTATR_BREAKWORD ); - aStr.EraseAllChars( CH_TXTATR_INWORD ); + aStr = comphelper::string::remove(aStr, CH_TXTATR_BREAKWORD); + aStr = comphelper::string::remove(aStr, CH_TXTATR_INWORD); xub_StrLen nStart = 0; String sX( 'x' ); if( pPam->Start()->nContent > 0 ) diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx index 3e9bc8d68ef1..063aeb6ef103 100644 --- a/sw/source/core/doc/acmplwrd.cxx +++ b/sw/source/core/doc/acmplwrd.cxx @@ -30,6 +30,7 @@ #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <tools/urlobj.hxx> #include <hintids.hxx> #include <hints.hxx> @@ -266,8 +267,8 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) } String aNewWord(rWord); - aNewWord.EraseAllChars( CH_TXTATR_INWORD ); - aNewWord.EraseAllChars( CH_TXTATR_BREAKWORD ); + aNewWord = comphelper::string::remove(aNewWord, CH_TXTATR_INWORD); + aNewWord = comphelper::string::remove(aNewWord, CH_TXTATR_BREAKWORD); pImpl->AddDocument(rDoc); sal_Bool bRet = sal_False; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d4929bb853a8..0d1454e0089e 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <tools/urlobj.hxx> #include <tools/poly.hxx> #include <tools/multisel.hxx> @@ -1214,7 +1215,7 @@ static void lcl_FormatPostIt( aStr = pField->GetPar2(); #if defined( WNT ) // Throw out all CR in Windows - aStr.EraseAllChars( '\r' ); + aStr = comphelper::string::remove(aStr, '\r'); #endif pIDCO->InsertString( aPam, aStr ); } diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 85fd54e75272..1cf820539fa5 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -34,6 +34,7 @@ #include <vcl/cmdevt.hxx> #include <unotools/charclass.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/transliterationwrapper.hxx> #include <swwait.hxx> #include <fmtsrnd.hxx> @@ -789,7 +790,7 @@ sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr ) String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(), *rAttr.GetEnd() - *rAttr.GetStart() ) ); - sTxt.EraseAllChars( 0x0a ); + sTxt = comphelper::string::remove(sTxt, 0x0a); sTxt.EraseLeadingChars().EraseTrailingChars(); if( sTxt.Len() ) diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 1c8baddcb83b..9b8518812c7b 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/linguistic2/XProofreader.hpp> #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/text/XFlatParagraph.hpp> +#include <comphelper/string.hxx> #include <unoflatpara.hxx> @@ -1012,7 +1013,8 @@ uno::Reference< XSpellAlternatives > { String aText( pNode->GetTxt().Copy( nBegin, nLen ) ); String aWord( aText ); - aWord.EraseAllChars( CH_TXTATR_BREAKWORD ).EraseAllChars( CH_TXTATR_INWORD ); + aWord = comphelper::string::remove(aWord, CH_TXTATR_BREAKWORD); + aWord = comphelper::string::remove(aWord, CH_TXTATR_INWORD); uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() ); if( xSpell.is() ) diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index d36b697fa793..bcf4e3e7f685 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -29,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - +#include <comphelper/string.hxx> #include <sfx2/linkmgr.hxx> #include <doc.hxx> #include <editsh.hxx> @@ -402,9 +402,8 @@ SwDDEField::~SwDDEField() String SwDDEField::Expand() const { xub_StrLen nPos; - String aStr( ((SwDDEFieldType*)GetTyp())->GetExpansion() ); + String aStr(comphelper::string::remove(((SwDDEFieldType*)GetTyp())->GetExpansion(), '\r')); - aStr.EraseAllChars( '\r' ); while( (nPos = aStr.Search( '\t' )) != STRING_NOTFOUND ) aStr.SetChar( nPos, ' ' ); while( (nPos = aStr.Search( '\n' )) != STRING_NOTFOUND ) diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index e520cdbda4f2..1b86c10a1db2 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -29,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - +#include <comphelper/string.hxx> #include <frmfmt.hxx> #include <doc.hxx> #include <index.hxx> @@ -124,8 +124,7 @@ void SwDDETable::ChangeContent() // zugriff auf den DDEFldType SwDDEFieldType* pDDEType = (SwDDEFieldType*)aDepend.GetRegisteredIn(); - String aExpand = pDDEType->GetExpansion(); - aExpand.EraseAllChars( '\r' ); + String aExpand = comphelper::string::remove(pDDEType->GetExpansion(), '\r'); for( sal_uInt16 n = 0; n < aLines.Count(); ++n ) { diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 3b5284965234..79cc783b5bcd 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -35,6 +35,7 @@ #include <unotools/localedatawrapper.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <editeng/unolingu.hxx> #include <doc.hxx> #include <pam.hxx> @@ -377,7 +378,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) // alle Sonderzeichen entfernen (durch Blanks ersetzen): if( sTxt.Len() ) { - sTxt.EraseAllChars( 0xad ); + sTxt = comphelper::string::remove(sTxt, 0xad); for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p ) { if( *p < 0x20 ) diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index ed7d495a06ec..57102e8f675e 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <tools/resid.hxx> #include <hintids.hxx> #include <swtypes.hxx> @@ -707,8 +708,7 @@ String SwFormToken::GetString() const if( sText.Len() ) { sRet += TOX_STYLE_DELIMITER; - String sTmp( sText ); - sTmp.EraseAllChars( TOX_STYLE_DELIMITER ); + String sTmp(comphelper::string::remove(sText, TOX_STYLE_DELIMITER)); sRet += sTmp; sRet += TOX_STYLE_DELIMITER; } diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 9142689b1c87..35d5ea18f65d 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -30,6 +30,7 @@ #include "precompiled_sw.hxx" #include <hintids.hxx> #include <tools/stream.hxx> +#include <comphelper/string.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS #include <svl/svstdarr.hxx> @@ -197,7 +198,7 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) { String aOutStr( aStr.Copy( nStrPos, nNextAttr - nStrPos ) ); if ( !bExportSoftHyphens ) - aOutStr.EraseAllChars( CHAR_SOFTHYPHEN ); + aOutStr = comphelper::string::remove(aOutStr, CHAR_SOFTHYPHEN); rWrt.Strm().WriteUnicodeOrByteText( aOutStr ); } diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index b07e98f6d343..0830c1f8fd0f 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp> +#include <comphelper/string.hxx> #include <svx/svxids.hrc> #include "hintids.hxx" #include <tools/string.hxx> @@ -1803,8 +1804,9 @@ void SwHTMLWriter::AddLinkTarget( const String& rURL ) String aURL( rURL.Copy( 1 ) ); - String sCmp( aURL.Copy( bEncoded ? nPos+2 : nPos ) ); // nPos-1+1/3 (-1 wg. Erase) - sCmp.EraseAllChars(); + // nPos-1+1/3 (-1 wg. Erase) + String sCmp(comphelper::string::remove(aURL.Copy(bEncoded ? nPos+2 : nPos), + ' ')); if( !sCmp.Len() ) return; diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 7fc91799d7a5..7f234e8fd577 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -31,6 +31,7 @@ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> @@ -1696,8 +1697,8 @@ void SwHTMLParser::InsertInput() // geloescht werden. if( !bKeepCRLFInValue ) { - sText.EraseAllChars( _CR ); - sText.EraseAllChars( _LF ); + sText = comphelper::string::remove(sText, _CR); + sText = comphelper::string::remove(sText, _LF); } const uno::Reference< XMultiServiceFactory > & rServiceFactory = diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 59759eced76b..7e6c1ff109fe 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -30,6 +30,7 @@ #include "precompiled_sw.hxx" #include "hintids.hxx" +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <svx/svxids.hrc> @@ -1134,8 +1135,7 @@ ANCHOR_SETEVENT: xub_StrLen nPos = sDecoded.SearchBackward( cMarkSeperator ); if( STRING_NOTFOUND != nPos ) { - String sCmp( sDecoded.Copy( nPos+1 ) ); - sCmp.EraseAllChars(); + String sCmp(comphelper::string::remove(sDecoded.Copy(nPos+1), ' ')); if( sCmp.Len() ) { sCmp.ToLowerAscii(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 29a4da1f0c32..f22418d27bc1 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -29,10 +29,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/i18n/ScriptType.hpp> +#include <comphelper/string.hxx> #include <sfx2/sfx.hrc> #include <svx/svxids.hrc> #if OSL_DEBUG_LEVEL > 1 @@ -394,14 +394,19 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, if( sJmpMark.Len() ) { eJumpTo = JUMPTO_MARK; - String sCmp; xub_StrLen nLastPos, nPos = 0; while( STRING_NOTFOUND != ( nLastPos = sJmpMark.Search( cMarkSeperator, nPos + 1 )) ) nPos = nLastPos; - if( nPos && ( sCmp = sJmpMark.Copy( nPos + 1 ) ). - EraseAllChars().Len() ) + String sCmp; + if (nPos) + { + sCmp = comphelper::string::remove( + sJmpMark.Copy(nPos + 1), ' '); + } + + if( sCmp.Len() ) { sCmp.ToLowerAscii(); if( sCmp.EqualsAscii( pMarkToRegion ) ) @@ -5346,8 +5351,8 @@ void SwHTMLParser::ParseMoreMetaOptions() aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_script_type ) ) return; - aContent.EraseAllChars( _CR ); - aContent.EraseAllChars( _LF ); + aContent = comphelper::string::remove(aContent, _CR); + aContent = comphelper::string::remove(aContent, _LF); if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdendnote ) ) { diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index d4d9f4e84d57..cfb651ac4507 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -32,6 +32,7 @@ #include <stdlib.h> #include <hintids.hxx> +#include <comphelper/string.hxx> #include <svl/urihelper.hxx> #include <rtl/tencinfo.h> #include <vcl/wrkwin.hxx> @@ -1092,8 +1093,7 @@ void SwHTMLWriter::OutHyperlinkHRefValue( const String& rURL ) xub_StrLen nPos = sURL.SearchBackward( cMarkSeperator ); if( STRING_NOTFOUND != nPos ) { - String sCmp( sURL.Copy( nPos+1 ) ); - sCmp.EraseAllChars(); + String sCmp(comphelper::string::remove(sURL.Copy(nPos+1), ' ')); if( sCmp.Len() ) { sCmp.ToLowerAscii(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index e7088a4da9d5..43d7c0a3189d 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -41,6 +41,7 @@ #endif #include <hintids.hxx> +#include <comphelper/string.hxx> #include <tools/urlobj.hxx> #include <editeng/boxitem.hxx> #include <editeng/cmapitem.hxx> @@ -783,10 +784,9 @@ bool AttributeOutputBase::AnalyzeURL( const String& rUrl, const String& /*rTarge xub_StrLen nPos = sMark.SearchBackward( cMarkSeperator ); - String sRefType( sMark.Copy( nPos+1 ) ); - sRefType.EraseAllChars(); + String sRefType(comphelper::string::remove(sMark.Copy(nPos+1), ' ')); - // i21465 Only interested in outline references + // #i21465# Only interested in outline references if ( sRefType.EqualsAscii( pMarkToOutline ) ) { String sLink = sMark.Copy(0, nPos); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index f9286353d9cc..6c0b88d5fb8f 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -93,6 +93,7 @@ #include <fmtfsize.hxx> #include <comphelper/extract.hxx> #include <comphelper/stlunosequence.hxx> +#include <comphelper/string.hxx> #include <writerfilter/doctok/sprmids.hxx> #include "writerhelper.hxx" @@ -2730,8 +2731,7 @@ void MSWordExportBase::AddLinkTarget(const String& rURL) if( nPos < 2 ) return; - String sCmp( aURL.Copy( nPos+1 ) ); - sCmp.EraseAllChars(); + String sCmp(comphelper::string::remove(aURL.Copy(nPos+1), ' ')); if( !sCmp.Len() ) return; diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index c049b7be0f13..236ff87dc271 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <svl/urihelper.hxx> #include <hintids.hxx> #include <osl/endian.h> @@ -966,9 +967,9 @@ OutlinerParaObject* SwWW8ImplReader::ImportAsOutliner(String &rString, WW8_CP nS long nDummy(0); lcl_StripFields(rString, nDummy); //Strip out word's special characters for the simple string - rString.EraseAllChars(0x1); - rString.EraseAllChars(0x5); - rString.EraseAllChars(0x8); + rString = comphelper::string::remove(rString, 0x1); + rString = comphelper::string::remove(rString, 0x5); + rString = comphelper::string::remove(rString, 0x8); rString.SearchAndReplaceAllAscii("\007\007", String::CreateFromAscii("\007\012")); rString.SearchAndReplaceAll(0x7, ' '); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 9c87f1a5268d..6287d8ce3bd4 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -36,6 +36,7 @@ #include <tools/solar.h> #include <comphelper/storagehelper.hxx> +#include <comphelper/string.hxx> #include <sot/storinfo.hxx> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/ElementModes.hpp> @@ -1112,7 +1113,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) // Thus, delete character 0x01, which stands for such a graphic. if (aF.nId==51) //#i56768# only do it for the MACROBUTTON field, since DropListFields need the 0x01. { - aStr.EraseAllChars( 0x01 ); + aStr = comphelper::string::remove(aStr, 0x01); } eF_ResT eRes = (this->*aWW8FieldTab[aF.nId])( &aF, aStr ); @@ -1620,7 +1621,8 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, String& rStr ) break; } } - aDocProperty.EraseAllChars('"'); + + aDocProperty = comphelper::string::remove(aDocProperty, '"'); /* There are up to 26 fields that may be meant by 'DocumentProperty'. diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 8b32b9906372..1d0d189336bb 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -48,6 +48,7 @@ #endif // dump #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/localedatawrapper.hxx> #include <i18npool/lang.h> #include <editeng/unolingu.hxx> @@ -6249,7 +6250,7 @@ void lcl_checkFontname( String& sString ) // if anything was found, remove \u0001 + leading/trailing ';' if( bFound ) { - sString.EraseAllChars( sal_Unicode( 1 ) ); + sString = comphelper::string::remove(sString, 1); sString.EraseLeadingAndTrailingChars( sal_Unicode( ';' ) ); } } diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index c08bfb5bf6df..0fb63d5afeb3 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -33,6 +33,7 @@ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <sfx2/request.hxx> #include <svx/svxids.hrc> @@ -88,9 +89,7 @@ String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText ) { String sRet; - String aText(rText); - aText.EraseAllChars( '\r' ); - + String aText(comphelper::string::remove(rText, '\r')); sal_uInt16 nTokenPos = 0; while( STRING_NOTFOUND != nTokenPos ) diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx index 105691be41ce..fc6fbb347764 100644 --- a/sw/source/ui/cctrl/actctrl.cxx +++ b/sw/source/ui/cctrl/actctrl.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include "actctrl.hxx" void NumEditAction::Action() @@ -88,7 +89,7 @@ void NoSpaceEdit::Modify() String sTemp = GetText(); for(sal_uInt16 i = 0; i < sForbiddenChars.Len(); i++) { - sTemp.EraseAllChars( sForbiddenChars.GetChar(i) ); + sTemp = comphelper::string::remove(sTemp, sForbiddenChars.GetChar(i)); } sal_uInt16 nDiff = GetText().Len() - sTemp.Len(); if(nDiff) diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 8dbd080f39c7..bcd1bbf2a4da 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdb/XColumn.hpp> +#include <comphelper/string.hxx> #include <vector> #include <boost/scoped_ptr.hpp> @@ -532,7 +533,7 @@ void SwRestrictedComboBox::Modify() String sTemp = GetText(); for(sal_uInt16 i = 0; i < sForbiddenChars.Len(); i++) { - sTemp.EraseAllChars( sForbiddenChars.GetChar(i) ); + sTemp = comphelper::string::remove(sTemp, sForbiddenChars.GetChar(i)); } sal_uInt16 nDiff = GetText().Len() - sTemp.Len(); if(nDiff) diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index f4900be44a48..a49674d3936c 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <comphelper/string.hxx> #include <tools/ref.hxx> #include <hintids.hxx> @@ -209,7 +210,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) if( sTxt.Len() ) { - sTxt.EraseAllChars( 0xad ); + sTxt = comphelper::string::remove(sTxt, 0xad); for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p ) { if( *p < 0x20 ) diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index ed1b04bc45da..50f730a3a4d9 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -33,6 +33,7 @@ #undef SW_DLLIMPLEMENTATION #endif +#include <comphelper/string.hxx> #include <vcl/msgbox.hxx> #include <unotools/charclass.hxx> #include <editeng/unolingu.hxx> @@ -156,8 +157,7 @@ void SwFldInputDlg::StateChanged( StateChangedType nType ) void SwFldInputDlg::Apply() { - String aTmp( aEditED.GetText() ); - aTmp.EraseAllChars( '\r' ); + String aTmp(comphelper::string::remove(aEditED.GetText(), '\r')); rSh.StartAllAction(); sal_Bool bModified = sal_False; diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 4bbcda92318c..45e11c4af476 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -34,6 +34,7 @@ #endif +#include <comphelper/string.hxx> #include <sfx2/request.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> @@ -63,7 +64,7 @@ IMPL_LINK( SwInsertBookmarkDlg, ModifyHdl, BookmarkCombo *, pBox ) for(sal_uInt16 i = 0; i < BookmarkCombo::aForbiddenChars.Len(); i++) { sal_uInt16 nTmpLen = sTmp.Len(); - sTmp.EraseAllChars(BookmarkCombo::aForbiddenChars.GetChar(i)); + sTmp = comphelper::string::remove(sTmp, BookmarkCombo::aForbiddenChars.GetChar(i)); if(sTmp.Len() != nTmpLen) sMsg += BookmarkCombo::aForbiddenChars.GetChar(i); } @@ -125,8 +126,8 @@ void SwInsertBookmarkDlg::Apply() if ( nLen && (aBookmarkBox.GetEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND) ) { - String sEntry(aBookmarkBox.GetText()); - sEntry.EraseAllChars(aBookmarkBox.GetMultiSelectionSeparator()); + String sEntry(comphelper::string::remove(aBookmarkBox.GetText(), + aBookmarkBox.GetMultiSelectionSeparator())); rSh.SetBookmark( KeyCode(), sEntry, aEmptyStr ); rReq.AppendItem( SfxStringItem( FN_INSERT_BOOKMARK, sEntry ) ); diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx index 6cf63fe81ce5..7fc40b06f1ff 100644 --- a/sw/source/ui/ribbar/workctrl.cxx +++ b/sw/source/ui/ribbar/workctrl.cxx @@ -31,6 +31,7 @@ #include <string> +#include <comphelper/string.hxx> #include <svl/eitem.hxx> #include <svx/htmlmode.hxx> #include <sfx2/dispatch.hxx> @@ -685,8 +686,7 @@ void SwZoomBox_Impl::Select() { if ( !IsTravelSelect() ) { - String sEntry(GetText()); - sEntry.EraseAllChars( '%' ); + String sEntry(comphelper::string::remove(GetText(), '%')); sal_uInt16 nZoom = (sal_uInt16)sEntry.ToInt32(); if(nZoom < MINZOOM) nZoom = MINZOOM; diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 9f8a711c4533..727fceb61242 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -33,7 +33,7 @@ #undef SW_DLLIMPLEMENTATION #endif - +#include <comphelper/string.hxx> #include <vcl/msgbox.hxx> #include "wrtsh.hxx" @@ -176,7 +176,7 @@ IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit ) String sTblName = pEdit->GetText(); if(sTblName.Search(' ') != STRING_NOTFOUND) { - sTblName.EraseAllChars( ); + sTblName = comphelper::string::remove(sTblName, ' '); pEdit->SetText(sTblName); } diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 8c04deb68c51..e986f69b7059 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -132,9 +132,10 @@ #include <PostItMgr.hxx> -#include <ndtxt.hxx> //#outline level,added by zhaojianwei +#include <ndtxt.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> @@ -1783,8 +1784,10 @@ sal_Bool SwView::JumpToSwMark( const String& rMark ) IDocumentMarkAccess::const_iterator_t ppMark; IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); - if( STRING_NOTFOUND != nPos && - ( sCmp = sMark.Copy( nPos + 1 ) ).EraseAllChars().Len() ) + if( STRING_NOTFOUND != nPos ) + sCmp = comphelper::string::remove(sMark.Copy(nPos + 1), ' '); + + if( sCmp.Len() ) { String sName( sMark.Copy( 0, nPos ) ); sCmp.ToLowerAscii(); diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 86c2a00b10f4..143f3ca94789 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -54,6 +54,7 @@ #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> #include <shellio.hxx> @@ -120,7 +121,7 @@ IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, NoSpaceEdit*, pEdit) for(sal_uInt16 i = 0; i < pEdit->GetForbiddenChars().Len(); i++) { sal_uInt16 nTmpLen = sTmp.Len(); - sTmp.EraseAllChars(pEdit->GetForbiddenChars().GetChar(i)); + sTmp = comphelper::string::remove(sTmp, pEdit->GetForbiddenChars().GetChar(i)); if(sTmp.Len() != nTmpLen) sMsg += pEdit->GetForbiddenChars().GetChar(i); } diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx index 27a682ebe762..d83f5705b926 100644 --- a/sw/source/ui/vba/vbafield.cxx +++ b/sw/source/ui/vba/vbafield.cxx @@ -31,10 +31,11 @@ #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/text/XTextFieldsSupplier.hpp> -#include <ooo/vba/word/WdFieldType.hpp> #include <com/sun/star/text/FilenameDisplayFormat.hpp> #include <com/sun/star/util/XRefreshable.hpp> #include <com/sun/star/util/XUpdatable.hpp> +#include <comphelper/string.hxx> +#include <ooo/vba/word/WdFieldType.hpp> #include <swtypes.hxx> using namespace ::ooo::vba; @@ -491,7 +492,7 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const break; } } - aDocProperty.EraseAllChars('"'); + aDocProperty = comphelper::string::remove(aDocProperty, '"'); OSL_TRACE("SwVbaFields::Create_Field_DocProperty, the document property name is %s ",rtl::OUStringToOString( aDocProperty, RTL_TEXTENCODING_UTF8 ).getStr() ); if( aDocProperty.Len() == 0 ) { diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index 64564efd1671..fb373b2c3632 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -237,8 +237,6 @@ public: ByteString& EraseLeadingChars( sal_Char c = ' ' ); ByteString& EraseTrailingChars( sal_Char c = ' ' ); ByteString& EraseLeadingAndTrailingChars( sal_Char c = ' ' ); - ByteString& EraseAllChars( sal_Char c = ' ' ); - ByteString& ConvertLineEnd( LineEnd eLineEnd ); ByteString& ConvertLineEnd() { return ConvertLineEnd( GetSystemLineEnd() ); } @@ -491,7 +489,6 @@ public: UniString& EraseLeadingChars( sal_Unicode c = ' ' ); UniString& EraseTrailingChars( sal_Unicode c = ' ' ); UniString& EraseLeadingAndTrailingChars( sal_Unicode c = ' ' ); - UniString& EraseAllChars( sal_Unicode c = ' ' ); UniString& Reverse(); UniString& ConvertLineEnd( LineEnd eLineEnd ); diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index da98a85e09a6..aad7df6dd67e 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -810,49 +810,6 @@ STRING& STRING::EraseLeadingAndTrailingChars( STRCODE c ) // ----------------------------------------------------------------------- -STRING& STRING::EraseAllChars( STRCODE c ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - sal_Int32 nCount = 0; - for (sal_Int32 i = 0; i < mpData->mnLen; ++i) { - if ( mpData->maStr[i] == c ) - ++nCount; - } - - if ( nCount ) - { - if ( nCount == mpData->mnLen ) - { - STRING_NEW((STRING_TYPE **)&mpData); - } - else - { - // Neuen String anlegen - STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount ); - - // Alten String kopieren und initialisieren - nCount = 0; - for( xub_StrLen j = 0; j < mpData->mnLen; ++j ) - { - if ( mpData->maStr[j] != c ) - { - pNewData->maStr[nCount] = mpData->maStr[j]; - ++nCount; - } - } - - // Alte Daten loeschen und Neue zuweisen - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - } - } - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::ToLowerAscii() { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index 509ef731ab75..368ca6ed9154 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -26,6 +26,8 @@ * ************************************************************************/ +#include <comphelper/string.hxx> + #include "rtl/ustrbuf.hxx" #include "vcl/cmdevt.hxx" @@ -682,10 +684,8 @@ void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem, AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) i_pSalMenuItem; - String aText( i_rText ); - // Delete mnemonics - aText.EraseAllChars( '~' ); + String aText( comphelper::string::remove(i_rText, '~') ); /* #i90015# until there is a correct solution strip out any appended (.*) in menubar entries @@ -933,10 +933,8 @@ AquaSalMenuItem::AquaSalMenuItem( const SalItemParams* pItemData ) : mpSubMenu( NULL ), mpMenuItem( nil ) { - String aText( pItemData->aText ); - // Delete mnemonics - aText.EraseAllChars( '~' ); + String aText( comphelper::string::remove(pItemData->aText, '~') ); if (pItemData->eType == MENUITEM_SEPARATOR) { diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 10f7e50d9aad..f076bea45ee6 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -33,6 +33,7 @@ #include <boost/ptr_container/ptr_vector.hpp> +#include <comphelper/string.hxx> #include <osl/file.hxx> #include <osl/mutex.hxx> @@ -290,11 +291,11 @@ FieldUnitStringList* ImplGetCleanedFieldUnits() size_t nUnits = pUnits->size(); pSVData->maCtrlData.mpCleanUnitStrings = new FieldUnitStringList(); pSVData->maCtrlData.mpCleanUnitStrings->reserve( nUnits ); - for( size_t i = 0; i < nUnits; i++ ) + for( size_t i = 0; i < nUnits; ++i ) { - String aUnit( (*pUnits)[i].first ); - aUnit.EraseAllChars( sal_Unicode( ' ' ) ); - aUnit.ToLowerAscii(); + rtl::OUString aUnit( (*pUnits)[i].first ); + aUnit = comphelper::string::remove(aUnit, ' '); + aUnit = aUnit.toAsciiLowerCase(); std::pair< String, FieldUnit > aElement( aUnit, (*pUnits)[i].second ); pSVData->maCtrlData.mpCleanUnitStrings->push_back( aElement ); } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index a0a81e93a573..35b35cafc66a 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -68,8 +68,9 @@ #include <com/sun/star/uno/Any.hxx> -#include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <sot/exchange.hxx> #include <sot/formats.hxx> @@ -781,10 +782,10 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI String Edit::ImplGetValidString( const String& rString ) const { - String aValidString( rString ); - aValidString.EraseAllChars( _LF ); - aValidString.EraseAllChars( _CR ); - aValidString.SearchAndReplaceAll( '\t', ' ' ); + rtl::OUString aValidString( rString ); + aValidString = comphelper::string::remove(aValidString, _LF); + aValidString = comphelper::string::remove(aValidString, _CR); + aValidString = aValidString.replace('\t', ' '); return aValidString; } diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 54e900c7bef1..4f56bad14046 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -29,6 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include <comphelper/string.hxx> + #ifndef _BIGINT_HXX #define _TOOLS_BIGINT #include "tools/bigint.hxx" @@ -1140,9 +1142,9 @@ static FieldUnit ImplStringToMetric( const String &rMetricString ) if( pList ) { // return FieldUnit - String aStr( rMetricString ); - aStr.ToLowerAscii(); - aStr.EraseAllChars( sal_Unicode( ' ' ) ); + rtl::OUString aStr( rMetricString ); + aStr = aStr.toAsciiLowerCase(); + aStr = comphelper::string::remove(aStr, ' '); for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) { if ( it->first.Equals( aStr ) ) |