[Libreoffice-commits] .: 7 commits - basctl/source basic/source comphelper/inc comphelper/source cui/source dbaccess/source editeng/source filter/source formula/source fpicker/source framework/source Makefile.top oox/inc oox/source reportdesign/source sc/source sd/source sfx2/inc sfx2/source svl/source svtools/source svx/source sw/source tools/inc tools/source unotools/inc unotools/source unusedcode.easy uui/source vcl/inc vcl/Library_vcl.mk vcl/Package_inc.mk vcl/source xmloff/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Jun 11 06:47:45 PDT 2012


 Makefile.top                                          |    4 
 basctl/source/basicide/baside2b.cxx                   |   12 -
 basic/source/runtime/methods.cxx                      |   10 
 basic/source/runtime/methods1.cxx                     |    6 
 comphelper/inc/comphelper/string.hxx                  |    3 
 comphelper/source/misc/string.cxx                     |   12 -
 cui/source/dialogs/hangulhanjadlg.cxx                 |   15 -
 cui/source/dialogs/hlinettp.cxx                       |    4 
 cui/source/dialogs/thesdlg.cxx                        |    4 
 cui/source/options/optdict.cxx                        |    3 
 cui/source/options/optgenrl.cxx                       |    5 
 cui/source/options/optjava.cxx                        |    9 
 dbaccess/source/core/api/KeySet.cxx                   |   33 ---
 dbaccess/source/core/api/KeySet.hxx                   |   12 -
 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/inc/UITools.hxx                    |    9 
 dbaccess/source/ui/misc/HtmlReader.cxx                |   18 -
 dbaccess/source/ui/misc/RtfReader.cxx                 |    4 
 dbaccess/source/ui/misc/UITools.cxx                   |   26 --
 dbaccess/source/ui/querydesign/QueryDesignView.cxx    |    5 
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx |    3 
 editeng/source/editeng/eertfpar.cxx                   |    5 
 editeng/source/outliner/outliner.cxx                  |    4 
 editeng/source/rtf/svxrtf.cxx                         |    4 
 filter/source/msfilter/msdffimp.cxx                   |    4 
 formula/source/ui/dlg/parawin.cxx                     |    8 
 fpicker/source/office/iodlg.cxx                       |    5 
 framework/source/uielement/uicommanddescription.cxx   |    3 
 oox/inc/oox/helper/containerhelper.hxx                |    2 
 oox/source/helper/containerhelper.cxx                 |   10 
 reportdesign/source/core/api/ReportEngineJFree.cxx    |    6 
 sc/source/core/data/docpool.cxx                       |    8 
 sc/source/core/data/dpobject.cxx                      |    8 
 sc/source/core/data/dputil.cxx                        |    2 
 sc/source/core/tool/compiler.cxx                      |    4 
 sc/source/core/tool/interpr1.cxx                      |    8 
 sc/source/core/tool/rangeseq.cxx                      |    4 
 sc/source/filter/excel/xlformula.cxx                  |    2 
 sc/source/filter/html/htmlpars.cxx                    |    5 
 sc/source/ui/dbgui/dbnamdlg.cxx                       |    6 
 sc/source/ui/dbgui/scendlg.cxx                        |    5 
 sc/source/ui/drawfunc/drtxtob.cxx                     |    5 
 sc/source/ui/optdlg/tpusrlst.cxx                      |    7 
 sc/source/ui/view/editsh.cxx                          |    5 
 sc/source/ui/view/tabvwshe.cxx                        |    3 
 sd/source/ui/view/drviewsf.cxx                        |    5 
 sfx2/inc/sfx2/doctdlg.hxx                             |    3 
 sfx2/source/appl/linkmgr2.cxx                         |   20 +
 sfx2/source/appl/newhelp.cxx                          |    6 
 sfx2/source/dialog/dinfdlg.cxx                        |    6 
 sfx2/source/dialog/mailmodel.cxx                      |    6 
 sfx2/source/dialog/mgetempl.cxx                       |    7 
 sfx2/source/dialog/srchdlg.cxx                        |    2 
 sfx2/source/doc/objmisc.cxx                           |    6 
 sfx2/source/inc/sfxtypes.hxx                          |    2 
 svl/source/numbers/zforfind.cxx                       |    9 
 svl/source/numbers/zformat.cxx                        |   24 +-
 svl/source/numbers/zforscan.cxx                       |    7 
 svtools/source/control/ctrlbox.cxx                    |    7 
 svtools/source/dialogs/filedlg2.cxx                   |    6 
 svtools/source/svhtml/parhtml.cxx                     |    6 
 svx/source/dialog/docrecovery.cxx                     |    5 
 svx/source/dialog/passwd.cxx                          |    5 
 svx/source/fmcomp/fmgridcl.cxx                        |    8 
 svx/source/fmcomp/gridcell.cxx                        |    4 
 svx/source/form/datanavi.cxx                          |    3 
 svx/source/form/filtnav.cxx                           |    7 
 svx/source/form/fmshimp.cxx                           |    4 
 svx/source/svdraw/svdotext.cxx                        |    4 
 svx/source/svdraw/svdotxat.cxx                        |    4 
 sw/source/core/bastyp/calc.cxx                        |    4 
 sw/source/core/crsr/crstrvl.cxx                       |    2 
 sw/source/core/doc/docfld.cxx                         |    4 
 sw/source/core/edit/editsh.cxx                        |    5 
 sw/source/core/unocore/unotbl.cxx                     |    5 
 sw/source/filter/html/css1atr.cxx                     |    3 
 sw/source/filter/html/htmlatr.cxx                     |    3 
 sw/source/filter/html/htmlbas.cxx                     |    5 
 sw/source/filter/html/htmlfldw.cxx                    |    7 
 sw/source/filter/html/htmlgrin.cxx                    |    2 
 sw/source/filter/html/parcss1.cxx                     |    3 
 sw/source/filter/html/swhtml.cxx                      |    5 
 sw/source/filter/rtf/rtffld.cxx                       |   11 -
 sw/source/ui/config/optload.cxx                       |    8 
 sw/source/ui/dbui/dbmgr.cxx                           |    6 
 sw/source/ui/dbui/mmaddressblockpage.cxx              |    3 
 sw/source/ui/dbui/mmlayoutpage.cxx                    |    4 
 sw/source/ui/fldui/fldmgr.cxx                         |    4 
 sw/source/ui/frmdlg/cption.cxx                        |    8 
 sw/source/ui/misc/bookmark.cxx                        |    9 
 sw/source/ui/misc/glosdoc.cxx                         |    3 
 sw/source/ui/ribbar/inputwin.cxx                      |    4 
 sw/source/ui/shells/annotsh.cxx                       |    5 
 sw/source/ui/shells/drwtxtex.cxx                      |    4 
 sw/source/ui/shells/textsh.cxx                        |    5 
 sw/source/ui/uiview/view.cxx                          |    2 
 sw/source/ui/uno/unomailmerge.cxx                     |    4 
 sw/source/ui/utlui/content.cxx                        |    5 
 sw/source/ui/utlui/navipi.cxx                         |    3 
 sw/source/ui/vba/vbatemplate.cxx                      |    8 
 tools/inc/tools/string.hxx                            |    3 
 tools/inc/tools/wintypes.hxx                          |   17 -
 tools/source/string/tustring.cxx                      |   32 --
 unotools/inc/unotools/ucbhelper.hxx                   |    3 
 unotools/source/ucbhelper/ucbhelper.cxx               |   28 --
 unusedcode.easy                                       |   12 -
 uui/source/logindlg.cxx                               |    7 
 vcl/Library_vcl.mk                                    |    1 
 vcl/Package_inc.mk                                    |    1 
 vcl/inc/vcl/fixbrd.hxx                                |   75 ------
 vcl/inc/vcl/tabctrl.hxx                               |    1 
 vcl/source/control/fixbrd.cxx                         |  196 ------------------
 vcl/source/window/window.cxx                          |    1 
 xmloff/source/style/xmlnumfi.cxx                      |    3 
 117 files changed, 265 insertions(+), 763 deletions(-)

New commits:
commit 8f5629fd5aafc85e509a4160a11a285b0a66e7c0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 11 13:15:18 2012 +0100

    remove EraseLeadingChars and EraseTrailingChars
    
    Change-Id: Ib9797fe97cd008cc6508ce8cec47dc5373416892

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index ebb67bf..c43ea05 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -126,9 +126,8 @@ void lcl_SeparateNameAndIndex( const String& rVName, String& rVar, String& rInde
         {
             rIndex = rVar.Copy( nIndexStart+1, nIndexEnd-nIndexStart-1 );
             rVar.Erase( nIndexStart );
-            rVar.EraseTrailingChars();
-            rIndex.EraseLeadingChars();
-            rIndex.EraseTrailingChars();
+            rVar = comphelper::string::stripEnd(rVar, ' ');
+            rIndex = comphelper::string::strip(rIndex, ' ');
         }
     }
 
@@ -1948,8 +1947,7 @@ sal_Bool WatchTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
             if( !pItem->mpObject && (pItem->mpArray == NULL || pItem->nDimLevel == pItem->nDimCount) )
             {
                 aEditingRes = SvHeaderTabListBox::GetEntryText( pEntry, ITEM_ID_VALUE-1 );
-                aEditingRes.EraseLeadingChars();
-                aEditingRes.EraseTrailingChars();
+                aEditingRes = comphelper::string::strip(aEditingRes, ' ');
                 bEdit = sal_True;
             }
         }
@@ -1966,9 +1964,7 @@ sal_Bool WatchTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString
     WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
     String aVName( pItem->maName );
 
-    String aResult = rNewText;
-    aResult.EraseLeadingChars();
-    aResult.EraseTrailingChars();
+    String aResult = comphelper::string::strip(rNewText, ' ');
 
     sal_uInt16 nResultLen = aResult.Len();
     sal_Unicode cFirst = aResult.GetChar( 0 );
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 2333a77..9943ad3 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1188,9 +1188,8 @@ RTLFUNC(LTrim)
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
     else
     {
-        String aStr( rPar.Get(1)->GetString() );
-        aStr.EraseLeadingChars();
-        rPar.Get(0)->PutString( aStr );
+        rtl::OUString aStr(comphelper::string::stripStart(rPar.Get(1)->GetString(), ' '));
+        rPar.Get(0)->PutString(aStr);
     }
 }
 
@@ -1438,9 +1437,8 @@ RTLFUNC(RTrim)
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
     else
     {
-        String aStr( rPar.Get(1)->GetString() );
-        aStr.EraseTrailingChars();
-        rPar.Get(0)->PutString( aStr );
+        rtl::OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetString(), ' '));
+        rPar.Get(0)->PutString(aStr);
     }
 }
 
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 2195a17..42ea005 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -682,10 +682,8 @@ RTLFUNC(Trim)
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
     else
     {
-        String aStr( rPar.Get(1)->GetString() );
-        aStr.EraseLeadingChars();
-        aStr.EraseTrailingChars();
-        rPar.Get(0)->PutString( aStr );
+        rtl::OUString aStr(comphelper::string::strip(rPar.Get(1)->GetString(), ' '));
+        rPar.Get(0)->PutString(aStr);
     }
 }
 
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 93705c6..2deec05 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -46,6 +46,7 @@
 #include <com/sun/star/util/XFlushable.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 
 #define HHC editeng::HangulHanjaConversion
 #define LINE_CNT        static_cast< sal_uInt16 >(2)
@@ -1201,9 +1202,8 @@ namespace svx
 
     IMPL_LINK_NOARG(HangulHanjaNewDictDialog, OKHdl)
     {
-        String  aName( m_aDictNameED.GetText() );
+        String  aName(comphelper::string::stripEnd(m_aDictNameED.GetText(), ' '));
 
-        aName.EraseTrailingChars();
         m_bEntered = aName.Len() > 0;
         if( m_bEntered )
             m_aDictNameED.SetText( aName );     // do this in case of trailing chars have been deleted
@@ -1214,9 +1214,8 @@ namespace svx
 
     IMPL_LINK_NOARG(HangulHanjaNewDictDialog, ModifyHdl)
     {
-        String  aName( m_aDictNameED.GetText() );
+        String aName(comphelper::string::stripEnd(m_aDictNameED.GetText(), ' '));
 
-        aName.EraseTrailingChars();
         m_aOkBtn.Enable( aName.Len() > 0 );
 
         return 0;
@@ -1247,10 +1246,7 @@ namespace svx
     bool HangulHanjaNewDictDialog::GetName( String& _rRetName ) const
     {
         if( m_bEntered )
-        {
-            _rRetName = m_aDictNameED.GetText();
-            _rRetName.EraseTrailingChars();
-        }
+            _rRetName = comphelper::string::stripEnd(m_aDictNameED.GetText(), ' ');
 
         return m_bEntered;
     }
@@ -1548,8 +1544,7 @@ namespace svx
     IMPL_LINK_NOARG(HangulHanjaEditDictDialog, OriginalModifyHdl)
     {
         m_bModifiedOriginal = true;
-        m_aOriginal = m_aOriginalLB.GetText();
-        m_aOriginal.EraseTrailingChars();
+        m_aOriginal = comphelper::string::stripEnd(m_aOriginalLB.GetText(), ' ');
 
         UpdateSuggestions();
         UpdateButtonStates();
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index d7082e6..ea7f2ad 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <unotools/pathoptions.hxx>
 #include <unotools/useroptions.hxx>
 #include <svl/adrparse.hxx>
@@ -505,8 +506,7 @@ void SvxHyperlinkInternetTp::SetOnlineMode( sal_Bool /*bEnable*/ )
     // State of target-button in subject to the current url-string
     // ( Can't display any targets in an document, if there is no
     //   valid url to a document )
-    String aStrCurrentTarget( maCbbTarget.GetText() );
-    aStrCurrentTarget.EraseTrailingChars();
+    String aStrCurrentTarget(comphelper::string::stripEnd(maCbbTarget.GetText(), ' '));
 
     if( aStrCurrentTarget == aEmptyStr                ||
         aStrCurrentTarget.EqualsIgnoreCaseAscii( sHTTPScheme )  ||
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index 17db923..0328a59 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -50,6 +50,7 @@
 #include <unotools/lingucfg.hxx>
 #include <i18npool/mslangid.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 #include <osl/file.hxx>
 
 #include <stack>
@@ -309,8 +310,7 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDi
     {
         // try again without trailing '.' chars. It may be a word at the
         // end of a sentence and not an abbreviation...
-        String aTxt( rTerm );
-        aTxt.EraseTrailingChars( '.' );
+        String aTxt(comphelper::string::stripEnd(rTerm, '.'));
         aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties );
         if (aMeanings.getLength())
         {
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index e300424..b1f3dc6 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -127,8 +127,7 @@ SvxNewDictionaryDialog::SvxNewDictionaryDialog( Window* pParent,
 
 IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl)
 {
-    String sDict = aNameEdit.GetText();
-    sDict.EraseTrailingChars();
+    String sDict = comphelper::string::stripEnd(aNameEdit.GetText(), ' ');
     // add extension for personal dictionaries
     sDict.AppendAscii(".dic");
 
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 093358d..2454f17 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -44,7 +44,7 @@
 #include <svx/strarray.hxx>
 #include <svx/svxids.hrc> // SID_FIELD_GRABFOCUS
 
-#define TRIM(s) s.EraseLeadingChars().EraseTrailingChars()
+#define TRIM(s) comphelper::string::strip(s, ' ')
 
 // struct GeneralTabPage_Impl --------------------------------------------
 
@@ -346,8 +346,7 @@ IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, Edit *, pEdit )
         String aTxt = pEdit->GetText();
         sal_Unicode cChar = ( aTxt.Len() > 0 ) ? aTxt.GetChar(0) : ' ';
         aShortStr.SetChar( nPos, cChar );
-        aShortStr.EraseTrailingChars();
-        aShortName.SetText( aShortStr );
+        aShortName.SetText(comphelper::string::stripEnd(aShortStr, ' '));
     }
     return 0;
 }
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 2e0a2f3..843514b 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -53,7 +53,6 @@
 // define ----------------------------------------------------------------
 
 #define CLASSPATH_DELIMITER SAL_PATHSEPARATOR
-#define STRIM( s )          s.EraseLeadingChars().EraseTrailingChars()
 #define BUTTON_BORDER       2
 #define RESET_TIMEOUT       300
 
@@ -745,8 +744,8 @@ SvxJavaParameterDlg::~SvxJavaParameterDlg()
 
 IMPL_LINK_NOARG(SvxJavaParameterDlg, ModifyHdl_Impl)
 {
-    String sParam = STRIM( m_aParameterEdit.GetText() );
-    m_aAssignBtn.Enable( sParam.Len() > 0 );
+    rtl::OUString sParam = comphelper::string::strip(m_aParameterEdit.GetText(), ' ');
+    m_aAssignBtn.Enable(!sParam.isEmpty());
 
     return 0;
 }
@@ -755,8 +754,8 @@ IMPL_LINK_NOARG(SvxJavaParameterDlg, ModifyHdl_Impl)
 
 IMPL_LINK_NOARG(SvxJavaParameterDlg, AssignHdl_Impl)
 {
-    String sParam = STRIM( m_aParameterEdit.GetText() );
-    if ( sParam.Len() > 0 )
+    rtl::OUString sParam = comphelper::string::strip(m_aParameterEdit.GetText(), ' ');
+    if (!sParam.isEmpty())
     {
         sal_uInt16 nPos = m_aAssignedList.GetEntryPos( sParam );
         if ( LISTBOX_ENTRY_NOTFOUND == nPos )
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 09c9d33..7925038 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 074d209..d5e1b6f 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -36,6 +36,7 @@
 #include <xmloff/txtimp.hxx>
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/nmspmap.hxx>
+#include <comphelper/string.hxx>
 #include <comphelper/types.hxx>
 #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 e0189ed..0beff91 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -76,6 +76,7 @@
 #include <comphelper/extract.hxx>
 #include <comphelper/interaction.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/string.hxx>
 #include <connectivity/dbexception.hxx>
 #include <connectivity/dbtools.hxx>
 #include <connectivity/sqlerror.hxx>
@@ -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 9d481ac..51bbed9 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 56648b9..758cee6 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -31,6 +31,7 @@
 #include <connectivity/dbtools.hxx>
 #include <tools/tenccvt.hxx>
 #include <comphelper/extract.hxx>
+#include <comphelper/string.hxx>
 #include "dbu_misc.hrc"
 #include "dbustrings.hrc"
 #include <sfx2/sfxhtml.hxx>
@@ -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 2ef4ccb..4534c95 100644
--- a/dbaccess/source/ui/misc/RtfReader.cxx
+++ b/dbaccess/source/ui/misc/RtfReader.cxx
@@ -47,6 +47,7 @@
 #include <connectivity/dbconversion.hxx>
 #include <connectivity/dbtools.hxx>
 #include <comphelper/extract.hxx>
+#include <comphelper/string.hxx>
 #include <tools/color.hxx>
 #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 6b91252..902bd0a 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 39ed8c6..ae2078c 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())
                 {
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index b8801c0..d3627ea 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -26,7 +26,7 @@
  *
  ************************************************************************/
 
-
+#include <comphelper/string.hxx>
 #include <vcl/wrkwin.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/msgbox.hxx>
@@ -571,8 +571,7 @@ void EditRTFParser::ReadField()
         if ( aFldInst.CompareIgnoreCaseToAscii( aHyperLinkMarker, aHyperLinkMarker.Len() ) == COMPARE_EQUAL )
         {
             aFldInst.Erase( 0, aHyperLinkMarker.Len() );
-            aFldInst.EraseLeadingChars();
-            aFldInst.EraseTrailingChars();
+            aFldInst = comphelper::string::strip(aFldInst, ' ');
             aFldInst.Erase( 0, 1 ); // "
             aFldInst.Erase( aFldInst.Len()-1, 1 );  // "
 
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index ffefcfb..cb2393f 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -26,7 +26,6 @@
  *
  ************************************************************************/
 
-
 #include <comphelper/string.hxx>
 #include <svl/intitem.hxx>
 #include <editeng/editeng.hxx>
@@ -515,8 +514,7 @@ bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView)
         }
 
         sal_uInt16 nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart;
-        String aLevel = aName.Copy( nPos );
-        aLevel.EraseLeadingChars( ' ' );
+        String aLevel = comphelper::string::stripStart(aName.Copy(nPos), ' ');
         nTabs = sal::static_int_cast< sal_uInt16 >(aLevel.ToInt32());
         if( nTabs )
             nTabs--; // Level 0 = "heading 1"
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 45fd74b..c57d3c5 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -812,9 +812,9 @@ void SvxRTFParser::ClearAttrStack()
 String& SvxRTFParser::DelCharAtEnd( String& rStr, const sal_Unicode cDel )
 {
     if( rStr.Len() && ' ' == rStr.GetChar( 0 ))
-        rStr.EraseLeadingChars();
+        rStr = comphelper::string::stripStart(rStr, ' ');
     if( rStr.Len() && ' ' == rStr.GetChar( rStr.Len()-1 ))
-        rStr.EraseTrailingChars();
+        rStr = comphelper::string::stripEnd(rStr, ' ');
     if( rStr.Len() && cDel == rStr.GetChar( rStr.Len()-1 ))
         rStr.Erase( rStr.Len()-1 );
     return rStr;
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index b5c27bd..21eb768 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3961,14 +3961,14 @@ rtl::OUString SvxMSDffManager::MSDFFReadZString(SvStream& rIn,
     if (!nLen)
         return rtl::OUString();
 
-    String sBuf;
+    rtl::OUString sBuf;
 
     if( bUniCode )
         sBuf = read_uInt16s_ToOUString(rIn, nLen/2);
     else
         sBuf = read_uInt8s_ToOUString(rIn, nLen, RTL_TEXTENCODING_MS_1252);
 
-    return sBuf.EraseTrailingChars( 0 );
+    return comphelper::string::stripEnd(sBuf, 0);
 }
 
 static Size lcl_GetPrefSize(const Graphic& rGraf, MapMode aWanted)
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index 77c5520..1f945aa 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/stritem.hxx>
 
@@ -244,11 +245,8 @@ String  ParaWin::GetActiveArgName()
 
 void ParaWin::SetArgument(sal_uInt16 no, const String& aString)
 {
-    if(no<aParaArray.size())
-    {
-        aParaArray[no] = aString;
-        aParaArray[no].EraseLeadingChars();
-    }
+    if (no < aParaArray.size())
+        aParaArray[no] = comphelper::string::stripStart(aString, ' ');
 }
 
 void ParaWin::DelParaArray()
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 006f8e8..acb1347 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -3401,7 +3401,7 @@ QueryFolderNameDialog::QueryFolderNameDialog
 IMPL_LINK_NOARG(QueryFolderNameDialog, OKHdl)
 {
     // trim the strings
-    aNameEdit.SetText( aNameEdit.GetText().EraseLeadingChars().EraseTrailingChars() );
+    aNameEdit.SetText(comphelper::string::strip(aNameEdit.GetText(), ' '));
     EndDialog( RET_OK );
     return 1;
 }
@@ -3410,8 +3410,7 @@ IMPL_LINK_NOARG(QueryFolderNameDialog, OKHdl)
 IMPL_LINK_NOARG(QueryFolderNameDialog, NameHdl)
 {
     // trim the strings
-    String aName = aNameEdit.GetText();
-    aName.EraseLeadingChars().EraseTrailingChars();
+    String aName = comphelper::string::strip(aNameEdit.GetText(), ' ');
     if ( aName.Len() )
     {
         if ( !aOKBtn.IsEnabled() )
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 95c03e0..29edf6a 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -57,6 +57,7 @@
 
 #include <vcl/mnemonic.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/string.hxx>
 #include <rtl/logfile.hxx>
 
 //_________________________________________________________________________________________________________________
@@ -324,7 +325,7 @@ void ConfigurationAccess_UICommand::fillInfoFromResult( CmdToInfoMap& rCmdInfo,
     rStr.SearchAndReplaceAllAscii(
         "%PRODUCTNAME", utl::ConfigManager::getProductName() );
     rCmdInfo.aLabel       = ::rtl::OUString( rStr );
-    rStr.EraseTrailingChars( '.' ); // Remove "..." from string
+    rStr = comphelper::string::stripEnd(rStr, '.'); // Remove "..." from string
     rCmdInfo.aCommandName = ::rtl::OUString( MnemonicGenerator::EraseAllMnemonicChars( rStr ));
     rCmdInfo.bCommandNameCreated = sal_True;
 }
diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx
index d092fc2..f01062e 100644
--- a/reportdesign/source/core/api/ReportEngineJFree.cxx
+++ b/reportdesign/source/core/api/ReportEngineJFree.cxx
@@ -34,6 +34,7 @@
 #include <comphelper/sequence.hxx>
 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/property.hxx>
+#include <comphelper/string.hxx>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
@@ -182,10 +183,7 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task
             const SfxFilter* pFilter = SfxFilter::GetDefaultFilter( aConfighelper.GetDocServiceNameFromMediaType(sMimeType) );
             String sExt;
             if ( pFilter )
-            {
-                sExt = pFilter->GetDefaultExtension();
-                sExt.EraseLeadingChars( '*' );
-            }
+                sExt = ::comphelper::string::stripStart(pFilter->GetDefaultExtension(), '*');
             else
                 sExt = String::CreateFromAscii(".rpt");
 
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 9d7daec..9fa6bca 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -28,6 +28,7 @@
 
 
 #include "scitems.hxx"
+#include <comphelper/string.hxx>
 #include <tools/shl.hxx>
 #include <vcl/outdev.hxx>
 #include <svl/aeitem.hxx>
@@ -776,10 +777,9 @@ SfxItemPresentation lcl_HFPresentation
         pItem = aIter.NextItem();
     }
 
-    rText.EraseTrailingChars();
-    rText.EraseTrailingChars( '+' );
-    rText.EraseTrailingChars();
-
+    rText = comphelper::string::stripEnd(rText, ' ');
+    rText = comphelper::string::stripEnd(rText, '+');
+    rText = comphelper::string::stripEnd(rText, ' ');
     return ePresentation;
 }
 
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index c7c6070..5a32643 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1316,7 +1316,8 @@ bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatc
                     }
 
                     aDequoted = rList.Copy( nStartPos, nNameEnd - nStartPos );
-                    aDequoted.EraseTrailingChars( ' ' );        // spaces before the closing bracket or semicolon
+                    // spaces before the closing bracket or semicolon
+                    aDequoted = comphelper::string::stripEnd(aDequoted, ' ');
                     nQuoteEnd = nClosePos + 1;
                     bParsed = true;
                 }
@@ -1488,7 +1489,7 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
                 {
                     aSpecField = aFieldNames[nField];
                     aRemaining.Erase( 0, sal::static_int_cast<xub_StrLen>(nMatched) );
-                    aRemaining.EraseLeadingChars( ' ' );
+                    aRemaining = comphelper::string::stripStart(aRemaining, ' ');
 
                     // field name has to be followed by item name in brackets
                     if ( aRemaining.GetChar(0) == '[' )
@@ -1561,7 +1562,8 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
         if ( !bUsed )
             bError = true;
 
-        aRemaining.EraseLeadingChars( ' ' );        // remove any number of spaces between entries
+        // remove any number of spaces between entries
+        aRemaining = comphelper::string::stripStart(aRemaining, ' ');
     }
 
     if ( !bError && !bHasData && aDataNames.size() == 1 )
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c59f05b..a1bc598 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3743,10 +3743,8 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula )
 
     ScTokenArray aArr;
     pArr = &aArr;
-    aFormula = rFormula;
+    aFormula = comphelper::string::strip(rFormula, ' ');
 
-    aFormula.EraseLeadingChars();
-    aFormula.EraseTrailingChars();
     nSrcPos = 0;
     bCorrected = false;
     if ( bAutoCorrect )
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c193a38..3d62b51 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -55,6 +55,7 @@
 #include "jumpmatrix.hxx"
 
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 
 #include <stdlib.h>
 #include <string.h>
@@ -2887,10 +2888,9 @@ void ScInterpreter::ScN()
 }
 
 void ScInterpreter::ScTrim()
-{   // Doesn't only trim but writes out twice!
-    String aVal( GetString() );
-    aVal.EraseLeadingChars();
-    aVal.EraseTrailingChars();
+{
+    // Doesn't only trim but writes out twice!
+    String aVal = comphelper::string::strip(GetString(), ' ');
     String aStr;
     register const sal_Unicode* p = aVal.GetBuffer();
     register const sal_Unicode* const pEnd = p + aVal.Len();
diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx
index 737db1e..9285051 100644
--- a/sc/source/core/tool/rangeseq.cxx
+++ b/sc/source/core/tool/rangeseq.cxx
@@ -31,7 +31,7 @@
 
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
-
+#include <comphelper/string.hxx>
 #include "rangeseq.hxx"
 #include "document.hxx"
 #include "dociter.hxx"
@@ -474,7 +474,7 @@ sal_Bool ScByteSequenceToString::GetString( String& rString, const uno::Any& rAn
     {
         rString = String( (const sal_Char*)aSeq.getConstArray(),
                             (xub_StrLen)aSeq.getLength(), nEncoding );
-        rString.EraseTrailingChars( (sal_Unicode) 0 );
+        rString = comphelper::string::stripEnd(rString, 0);
         return sal_True;
     }
     return false;
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 29c0bb1..4af76f0 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -677,7 +677,7 @@ void XclTokenArrayHelper::ConvertStringToList( ScTokenArray& rScTokArr, sal_Unic
         {
             String aToken( aString.GetToken( 0, cStringSep, nStringIx ) );
             if( bTrimLeadingSpaces )
-                aToken.EraseLeadingChars( ' ' );
+                aToken = comphelper::string::stripStart(aToken, ' ');
             if( nToken > 0 )
                 rScTokArr.AddOpCode( ocSep );
             rScTokArr.AddString( aToken );
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 019d057..f7ee768 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1572,9 +1572,10 @@ void ScHTMLLayoutParser::FontOn( ImportInfo* pInfo )
                     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;
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index a261ff6..d380c59 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <vcl/msgbox.hxx>
 
 #include "reffact.hxx"
@@ -454,12 +455,9 @@ IMPL_LINK_NOARG_INLINE_END(ScDbNameDlg, CancelBtnHdl)
 
 IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl)
 {
-    String  aNewName = aEdName.GetText();
+    String  aNewName = comphelper::string::strip(aEdName.GetText(), ' ');
     String  aNewArea = aEdAssign.GetText();
 
-    aNewName.EraseLeadingChars( ' ' );
-    aNewName.EraseTrailingChars( ' ' );
-
     if ( aNewName.Len() > 0 && aNewArea.Len() > 0 )
     {
         if ( ScRangeData::IsNameValid( aNewName, pDoc ) && !aNewName.EqualsAscii(STR_DB_LOCAL_NONAME) )
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index d846583..b9c2964 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -32,6 +32,7 @@
 
 
 #include "scitems.hxx"
+#include <comphelper/string.hxx>
 #include <svx/drawitem.hxx>
 #include <svx/xtable.hxx>
 #include <sfx2/objsh.hxx>
@@ -209,12 +210,10 @@ void ScNewScenarioDlg::SetScenarioData( const rtl::OUString& rName, const rtl::O
 
 IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl)
 {
-    String      aName   ( aEdName.GetText() );
+    String      aName = comphelper::string::strip(aEdName.GetText(), ' ');
     ScDocument* pDoc    = ((ScTabViewShell*)SfxViewShell::Current())->
                                 GetViewData()->GetDocument();
 
-    aName.EraseLeadingChars( ' ' );
-    aName.EraseTrailingChars( ' ' );
     aEdName.SetText( aName );
 
     if ( !pDoc->ValidTabName( aName ) )
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 08245a5..9029b5c 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -28,7 +28,7 @@
 
 #include <com/sun/star/linguistic2/XThesaurus.hpp>
 #include <com/sun/star/lang/Locale.hpp>
-
+#include <comphelper/string.hxx>
 #include "scitems.hxx"
 
 #include <editeng/adjitem.hxx>
@@ -409,8 +409,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
                 // use selected text as name for urls
                 String sReturn = pOutView->GetSelected();
                 sReturn.Erase(255);
-                sReturn.EraseTrailingChars();
-                aHLinkItem.SetName(sReturn);
+                aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
             }
         }
         rSet.Put(aHLinkItem);
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 3eee008..a4f7428 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -324,15 +324,12 @@ void ScTpUserLists::MakeListStr( String& rListStr )
 
     for(xub_StrLen i=0;i<nToken;i++)
     {
-        String aString=rListStr.GetToken(i,LF);
-        aString.EraseLeadingChars(' ');
-        aString.EraseTrailingChars(' ');
+        rtl::OUString aString = comphelper::string::strip(rListStr.GetToken(i, LF), ' ');
         aStr+=aString;
         aStr+=cDelimiter;
     }
 
-    aStr.EraseLeadingChars( cDelimiter );
-    aStr.EraseTrailingChars( cDelimiter );
+    aStr = comphelper::string::strip(aStr, cDelimiter);
     xub_StrLen nLen = aStr.Len();
 
     rListStr.Erase();
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index ef0308f..e5e03c1 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -27,7 +27,7 @@
  ************************************************************************/
 
 #include <com/sun/star/linguistic2/XThesaurus.hpp>
-
+#include <comphelper/string.hxx>
 #include "scitems.hxx"
 #include <editeng/eeitem.hxx>
 
@@ -692,8 +692,7 @@ void ScEditShell::GetState( SfxItemSet& rSet )
                         // use selected text as name for urls
                         String sReturn = pActiveView->GetSelected();
                         sReturn.Erase(255);
-                        sReturn.EraseTrailingChars();
-                        aHLinkItem.SetName(sReturn);
+                        aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
                     }
                     rSet.Put(aHLinkItem);
                 }
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index 08195cb..f3c678f 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <editeng/eeitem.hxx>
 
 #include "scitems.hxx"
@@ -122,7 +123,7 @@ String ScTabViewShell::GetSelectionText( sal_Bool bWholeWord )
                 while (  (nAt = aStrSelection.Search( '\t' )) != STRING_NOTFOUND )
                     aStrSelection.SetChar( nAt, ' ' );
 
-                aStrSelection.EraseTrailingChars( ' ' );
+                aStrSelection = comphelper::string::stripEnd(aStrSelection, ' ');
             }
         }
     }
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 38dc2b8..8b746a9 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -30,7 +30,7 @@
 #include "DrawViewShell.hxx"
 #include <com/sun/star/form/FormButtonType.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
-
+#include <comphelper/string.hxx>
 #include <svx/svxids.hrc>
 #include <svx/globl3d.hxx>
 #include <svx/hlnkitem.hxx>
@@ -116,8 +116,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
                 // use selected text as name for urls
                 String sReturn = pOLV->GetSelected();
                 sReturn.Erase(255);
-                sReturn.EraseTrailingChars();
-                aHLinkItem.SetName(sReturn);
+                aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
             }
         }
         else
diff --git a/sfx2/inc/sfx2/doctdlg.hxx b/sfx2/inc/sfx2/doctdlg.hxx
index 1d9160c..c38451c 100644
--- a/sfx2/inc/sfx2/doctdlg.hxx
+++ b/sfx2/inc/sfx2/doctdlg.hxx
@@ -28,6 +28,7 @@
 #ifndef _SFXDOCTDLG_HXX
 #define _SFXDOCTDLG_HXX
 
+#include <comphelper/string.hxx>
 #include <sfx2/doctempl.hxx>
 #include <vcl/lstbox.hxx>
 #include <vcl/edit.hxx>
@@ -73,7 +74,7 @@ public:
     ~SfxDocumentTemplateDlg();
 
     String GetTemplateName() const
-    { return aNameEd.GetText().EraseLeadingChars(); }
+    { return comphelper::string::stripStart(aNameEd.GetText(), ' '); }
     sal_uInt16 GetRegion() const { return aRegionLb.GetSelectEntryPos(); }
     String GetRegionName() const { return aRegionLb.GetSelectEntry(); }
 };
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 663e98e..be02f9f 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <sfx2/linkmgr.hxx>
 #include <com/sun/star/document/UpdateDocMode.hpp>
 #include <sfx2/objsh.hxx>
@@ -404,14 +405,25 @@ void MakeLnkName( String& rName, const String* pType, const String& rFile,
                     const String& rLink, const String* pFilter )
 {
     if( pType )
-        (rName = *pType).EraseLeadingChars().EraseTrailingChars() += cTokenSeperator;
+    {
+        rName = comphelper::string::strip(*pType, ' ');
+        rName += cTokenSeperator;
+    }
     else if( rName.Len() )
         rName.Erase();
 
-    ((rName += rFile).EraseLeadingChars().EraseTrailingChars() +=
-        cTokenSeperator ).EraseLeadingChars().EraseTrailingChars() += rLink;
+    rName += rFile;
+
+    rName = comphelper::string::strip(rName, ' ');
+    rName += cTokenSeperator;
+    rName = comphelper::string::strip(rName, ' ');
+    rName += rLink;
     if( pFilter )
-        ((rName += cTokenSeperator ) += *pFilter).EraseLeadingChars().EraseTrailingChars();
+    {
+        rName += cTokenSeperator;
+        rName += *pFilter;
+        rName = comphelper::string::strip(rName, ' ');
+    }
 }
 
 void LinkManager::ReconnectDdeLink(SfxObjectShell& rServer)
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 1f4c69e..1da4f36 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1073,7 +1073,7 @@ void SearchTabPage_Impl::RememberSearchText( const String& rSearchText )
 
 IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl)
 {
-    String aSearchText = TRIM( aSearchED.GetText() );
+    String aSearchText = comphelper::string::strip(aSearchED.GetText(), ' ');
     if ( aSearchText.Len() > 0 )
     {
         EnterWait();
@@ -1126,7 +1126,7 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, OpenHdl)
 
 IMPL_LINK_NOARG(SearchTabPage_Impl, ModifyHdl)
 {
-    String aSearchText = TRIM( aSearchED.GetText() );
+    String aSearchText = comphelper::string::strip(aSearchED.GetText(), ' ');
     aSearchBtn.Enable( aSearchText.Len() > 0 );
     return 0;
 }
@@ -3163,7 +3163,7 @@ void SfxHelpWindow_Impl::openDone(const ::rtl::OUString& sURL    ,
         }
 
         // When the SearchPage opens the help doc, then select all words, which are equal to its text
-        String sSearchText = TRIM( pIndexWin->GetSearchText() );
+        String sSearchText = comphelper::string::strip(pIndexWin->GetSearchText(), ' ');
         if ( sSearchText.Len() > 0 )
             pTextWin->SelectSearchText( sSearchText, pIndexWin->IsFullWordSearch() );
 
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index ba0d0c2..d96b6d0 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -68,6 +68,7 @@
 #include <sfx2/objsh.hxx>
 #include <sfx2/docfile.hxx>
 #include <comphelper/storagehelper.hxx>
+#include <comphelper/string.hxx>
 
 #include <sfx2/sfx.hrc>
 #include "dinfdlg.hrc"
@@ -193,9 +194,8 @@ String ConvertDateTime_Impl( const String& rName,
      String aStr( rWrapper.getDate( aD ) );
      aStr += pDelim;
      aStr += rWrapper.getTime( aT, sal_True, sal_False );
-     String aAuthor = rName;
-     aAuthor.EraseLeadingChars();
-     if ( aAuthor.Len() )
+     rtl::OUString aAuthor = comphelper::string::stripStart(rName, ' ');
+     if (!aAuthor.isEmpty())
      {
         aStr += pDelim;
         aStr += aAuthor;
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 1cf9a2a..79a4671 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -972,12 +972,12 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
     {
         if ( aFirstName.Len() )
         {
-            rFrom = TRIM( aFirstName );
+            rFrom = comphelper::string::strip(aFirstName, ' ');
 
             if ( aName.Len() )
                 rFrom += ' ';
         }
-        rFrom += TRIM( aName );
+        rFrom += comphelper::string::strip(aName, ' ');
         // remove illegal characters
         rFrom = comphelper::string::remove(rFrom, '<');
         rFrom = comphelper::string::remove(rFrom, '>');
@@ -993,7 +993,7 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
     {
         if ( rFrom.Len() )
             rFrom += ' ';
-        ( ( rFrom += '<' ) += TRIM( aEmailName ) ) += '>';
+        ( ( rFrom += '<' ) += comphelper::string::strip(aEmailName, ' ') ) += '>';
     }
     else
         rFrom.Erase();
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index d51ce3a..7d7926d 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <vcl/msgbox.hxx>
 #include <vcl/field.hxx>
 #include <svl/eitem.hxx>
@@ -362,7 +363,7 @@ IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit )
 */
 
 {
-    aBuf = pEdit->GetText().EraseLeadingChars();
+    aBuf = comphelper::string::stripStart(pEdit->GetText(), ' ');
     return 0;
 }
 IMPL_LINK_INLINE_END( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit )
@@ -379,7 +380,7 @@ IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, LoseFocusHdl, Edit *, pEdit )
 */
 
 {
-    const String aStr( pEdit->GetText().EraseLeadingChars() );
+    const String aStr(comphelper::string::stripStart(pEdit->GetText(), ' '));
     pEdit->SetText( aStr );
     // Update the Listbox of the base template if possible
     if ( aStr != aBuf )
@@ -579,7 +580,7 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
         if ( aNameEd.HasFocus() )
             LoseFocusHdl( &aNameEd );
 
-        if ( !pStyle->SetName( aNameEd.GetText().EraseLeadingChars() ) )
+        if (!pStyle->SetName(comphelper::string::stripStart(aNameEd.GetText(), ' ')))
         {
             InfoBox aBox( this, SfxResId( MSG_TABPAGE_INVALIDNAME ) );
             aBox.Execute();
diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx
index 0d5528a..b84a1bb 100644
--- a/sfx2/source/dialog/srchdlg.cxx
+++ b/sfx2/source/dialog/srchdlg.cxx
@@ -127,7 +127,7 @@ void SearchDialog::SaveConfig()
         sUserData += m_aSearchEdit.GetEntry(i);
         sUserData += '\t';
     }
-    sUserData.EraseTrailingChars( '\t' );
+    sUserData = comphelper::string::stripStart(sUserData, '\t');
     sUserData += ';';
     sUserData += String::CreateFromInt32( m_aWholeWordsBox.IsChecked() ? 1 : 0 );
     sUserData += ';';
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 3b44ed3..ff35108 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -71,9 +71,10 @@
 #include <com/sun/star/task/ErrorCodeRequest.hpp>
 #include <unotools/securityoptions.hxx>
 
-#include <comphelper/processfactory.hxx>
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 
 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
 #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
@@ -1658,8 +1659,7 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV )
     if( rKV.GetKey().CompareIgnoreCaseToAscii( "refresh" ) == COMPARE_EQUAL && rKV.GetValue().Len() )
     {
         sal_uInt32 nTime = aValue.GetToken(  0, ';' ).ToInt32() ;
-        String aURL = aValue.GetToken( 1, ';' );
-        aURL.EraseTrailingChars().EraseLeadingChars();
+        String aURL = comphelper::string::strip(aValue.GetToken( 1, ';' ), ' ');
         uno::Reference<document::XDocumentProperties> xDocProps(
             pDoc->getDocProperties());
         if( aURL.Copy(0, 4).CompareIgnoreCaseToAscii( "url=" ) == COMPARE_EQUAL )
diff --git a/sfx2/source/inc/sfxtypes.hxx b/sfx2/source/inc/sfxtypes.hxx
index c075f2a..3d533b0 100644
--- a/sfx2/source/inc/sfxtypes.hxx
+++ b/sfx2/source/inc/sfxtypes.hxx
@@ -95,8 +95,6 @@ struct _Capper
 #define DBG_OUTF(x)
 #endif
 
-#define TRIM(s) s.EraseLeadingChars().EraseTrailingChars()
-
 //------------------------------------------------------------------------
 
 #if defined(DBG_UTIL) && defined(WNT)
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 31f9c2c..5a21693 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1132,8 +1132,7 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt )
                         else if (nPat + nLen > rPat.getLength() && sStrArray[nNext].GetChar(nLen-1) == ' ')
                         {
                             // Trailing blanks in input.
-                            String aStr( sStrArray[nNext]);
-                            aStr.EraseTrailingChars(' ');
+                            String aStr(comphelper::string::stripEnd(sStrArray[nNext], ' '));
                             // Expand again in case of pattern "M. D. " and
                             // input "M. D.  ", maybe fetched far, but..
                             aStr.Expand( rPat.getLength() - nPat, ' ');
@@ -1206,8 +1205,7 @@ bool ImpSvNumberInputScan::SkipDatePatternSeparator( sal_uInt16 nParticle, xub_S
                     {
                         // The same ugly trailing blanks check as in
                         // IsAcceptedDatePattern().
-                        String aStr( sStrArray[nNext]);
-                        aStr.EraseTrailingChars(' ');
+                        String aStr(comphelper::string::stripEnd(sStrArray[nNext], ' '));
                         aStr.Expand( rPat.getLength() - nPat, ' ');
                         bOk = (rPat.indexOf( aStr, nPat) == nPat);
                     }
@@ -2543,9 +2541,8 @@ bool ImpSvNumberInputScan::IsNumberFormatMain(
         {
             // Here we may change the original, we don't need it anymore.
             // This saves copies and ToUpper() in GetLogical() and is faster.
+            sStrArray[0] = comphelper::string::strip(sStrArray[0], ' ');
             String& rStrArray = sStrArray[0];
-            rStrArray.EraseTrailingChars( ' ' );
-            rStrArray.EraseLeadingChars( ' ' );
             nLogical = GetLogical( rStrArray );
             if ( nLogical )
             {
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 5efeb3e..802232a 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1985,7 +1985,7 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutStr
             GetFormatter().GetNumDecimalSep().GetChar(0), true );
     if (rOutString.GetChar(0) == '-' &&
         comphelper::string::getTokenCount(rOutString, '0') == rOutString.Len())
-        rOutString.EraseLeadingChars('-');            // nicht -0
+        rOutString = comphelper::string::stripStart(rOutString, '-');            // nicht -0
 
     ImpTransliterate( rOutString, NumFor[0].GetNatNum() );
 }
@@ -2784,11 +2784,11 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
 
     String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds,
                 rtl_math_StringFormat_F, int(nCntPost), '.'));
-    sSecStr.EraseLeadingChars('0');
-    sSecStr.EraseLeadingChars('.');
+    sSecStr = comphelper::string::stripStart(sSecStr, '0');
+    sSecStr = comphelper::string::stripStart(sSecStr, '.');
     if ( bInputLine )
     {
-        sSecStr.EraseTrailingChars('0');
+        sSecStr = comphelper::string::stripEnd(sSecStr, '0');
         if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) )
             sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' );
         ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
@@ -3501,11 +3501,11 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber,
     sal_uLong nSeconds = (sal_uLong)floor( fTime );
     String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds,
                 rtl_math_StringFormat_F, int(nCntPost), '.'));
-    sSecStr.EraseLeadingChars('0');
-    sSecStr.EraseLeadingChars('.');
+    sSecStr = comphelper::string::stripStart(sSecStr, '0');
+    sSecStr = comphelper::string::stripStart(sSecStr, '.');
     if ( bInputLine )
     {
-        sSecStr.EraseTrailingChars('0');
+        sSecStr = comphelper::string::stripEnd(sSecStr, '0');
         if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) )
             sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' );
         ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
@@ -3849,7 +3849,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber,
             else
                 sStr = ::rtl::math::doubleToUString( fNumber,
                         rtl_math_StringFormat_F, rInfo.nCntPost, '.' );
-            sStr.EraseLeadingChars('0');        // fuehrende Nullen weg
+            sStr = comphelper::string::stripStart(sStr, '0');        // fuehrende Nullen weg
         }
         else if (fNumber == 0.0)            // Null
         {
@@ -3860,7 +3860,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber,
         {
             sStr = ::rtl::math::doubleToUString( fNumber,
                     rtl_math_StringFormat_F, 0, '.');
-            sStr.EraseLeadingChars('0');        // fuehrende Nullen weg
+            sStr = comphelper::string::stripStart(sStr, '0');        // fuehrende Nullen weg
         }
         xub_StrLen nPoint = sStr.Search( '.' );
         if ( nPoint != STRING_NOTFOUND )
@@ -3951,7 +3951,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber,
                 {
                     String sNum;
                     ImpGetOutputStandard(fNumber, sNum);
-                    sNum.EraseLeadingChars('-');
+                    sNum = comphelper::string::stripStart(sNum, '-');
                     sStr.Insert(sNum, k);
                 }
                 break;
@@ -4117,7 +4117,7 @@ bool SvNumberformat::ImpNumberFillWithThousands(
             {
                 String sNum;
                 ImpGetOutputStandard(rNumber, sNum);
-                sNum.EraseLeadingChars('-');
+                sNum = comphelper::string::stripStart(sNum, '-');
                 sStr.Insert(sNum, k);
             }
             break;
@@ -4235,7 +4235,7 @@ bool SvNumberformat::ImpNumberFill( String& sStr,       // number string
             {
                 String sNum;
                 ImpGetOutputStandard(rNumber, sNum);
-                sNum.EraseLeadingChars('-');    // Vorzeichen weg!!
+                sNum = comphelper::string::stripStart(sNum, '-');    // Vorzeichen weg!!
                 sStr.Insert(sNum, k);
             }
             break;
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 069d2d3..c883242 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -28,6 +28,7 @@
 
 
 #include <stdlib.h>
+#include <comphelper/string.hxx>
 #include <tools/debug.hxx>
 #include <i18npool/mslangid.hxx>
 #include <unotools/charclass.hxx>
@@ -487,8 +488,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr)
         if (nPos > 0)
         {
             sStr.Erase(0, nPos);
-            sStr.EraseLeadingChars();
-            sStr.EraseTrailingChars();
+            sStr = comphelper::string::strip(sStr, ' ');
             if (bConvertMode)
             {
                 pFormatter->ChangeIntl(eNewLnge);
@@ -498,8 +498,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr)
             else
                 sStr.Insert(rColorWord,0);
             sString.Erase(0, nPos);
-            sString.EraseLeadingChars();
-            sString.EraseTrailingChars();
+            sString = comphelper::string::strip(sString, ' ');
 
             if ( CharClass::isAsciiNumeric( sString ) )
             {
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 15eae11..9b29a82 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -34,6 +34,7 @@
 #include <vcl/helper.hxx>
 #include <sal/macros.h>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 #include <unotools/charclass.hxx>
 
 #include <svtools/sampletext.hxx>
@@ -1710,8 +1711,7 @@ void FontSizeBox::Modify()
 
     if ( bRelativeMode )
     {
-        XubString aStr = GetText();
-        aStr.EraseLeadingChars();
+        XubString aStr = comphelper::string::stripStart(GetText(), ' ');
 
         sal_Bool bNewMode = bRelative;
         sal_Bool bOldPtRelMode = bPtRelative;
@@ -1876,8 +1876,7 @@ void FontSizeBox::SetRelative( sal_Bool bNewRelative )
     if ( bRelativeMode )
     {
         Selection aSelection = GetSelection();
-        XubString  aStr = GetText();
-        aStr.EraseLeadingChars();
+        XubString aStr = comphelper::string::stripStart(GetText(), ' ');
 
         if ( bNewRelative )
         {
diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx
index 2b74255..5785246 100644
--- a/svtools/source/dialogs/filedlg2.cxx
+++ b/svtools/source/dialogs/filedlg2.cxx
@@ -81,7 +81,7 @@ KbdListBox::PreNotify( NotifyEvent& rNEvt )
             for ( sal_uInt16 i = 1; i < nEntries; i++ )
             {
                 UniString aEntry = GetEntry ( (i + nCurrentPos) % nEntries );
-                aEntry.EraseLeadingChars( ' ' );
+                aEntry = comphelper::string::stripStart(aEntry, ' ');
                 aEntry.ToUpperAscii();
                 UniString aCompare( cCharCode );
                 aCompare.ToUpperAscii();
@@ -266,8 +266,8 @@ IMPL_LINK( ImpPathDialog, SelectHdl, ListBox *, p )
         // isolate the pure name of the entry
         // removing trainling stuff and leading spaces
         UniString aEntry( pDirList->GetSelectEntry() );
+        aEntry = comphelper::string::stripStart(aEntry, ' ');
 
-        aEntry.EraseLeadingChars( ' ' );
         sal_uInt16 nPos = aEntry.Search( '/' );
         aEntry.Erase( nPos );
 
@@ -360,7 +360,7 @@ IMPL_LINK( ImpPathDialog, DblClickHdl, ListBox*, pBox )
     // removing trainling stuff and leading spaces
     UniString aEntry( pBox->GetSelectEntry() );
 
-    aEntry.EraseLeadingChars( ' ' );
+    aEntry = comphelper::string::stripStart(aEntry, ' ');
     sal_uInt16 nPos = aEntry.Search( '/' );
     aEntry.Erase( nPos );
 
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index d1c588c..36b81ec 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -153,8 +153,7 @@ sal_uInt32 HTMLOption::GetNumber() const
                  nToken<HTML_OPTION_CONTEXT_END) ||
                 nToken==HTML_O_VALUE,
         "GetNumber: Option not numerical" );
-    String aTmp( aValue );
-    aTmp.EraseLeadingChars();
+    String aTmp(comphelper::string::stripStart(aValue, ' '));
     sal_Int32 nTmp = aTmp.ToInt32();
     return nTmp >= 0 ? (sal_uInt32)nTmp : 0;
 }
@@ -164,8 +163,7 @@ sal_Int32 HTMLOption::GetSNumber() const
     DBG_ASSERT( (nToken>=HTML_OPTION_NUMBER_START && nToken<HTML_OPTION_NUMBER_END) ||
                 (nToken>=HTML_OPTION_CONTEXT_START && nToken<HTML_OPTION_CONTEXT_END),
         "GetSNumber: Option not numerical" );
-    String aTmp( aValue );
-    aTmp.EraseLeadingChars();
+    String aTmp(comphelper::string::stripStart(aValue, ' '));
     return aTmp.ToInt32();
 }
 
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index a7e09d2..32685fa 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -35,9 +35,10 @@
 #include "docrecovery.hrc"
 
 #include <comphelper/componentcontext.hxx>
+#include <comphelper/configurationhelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
-#include <comphelper/configurationhelper.hxx>
+#include <comphelper/string.hxx>
 #include <svtools/imagemgr.hxx>
 #include <svtools/xtextedt.hxx>
 #include <tools/urlobj.hxx>
@@ -1522,7 +1523,7 @@ sal_Bool BrokenRecoveryDialog::isExecutionNeeded()
 //===============================================
 IMPL_LINK_NOARG(BrokenRecoveryDialog, OkButtonHdl)
 {
-    String sPhysicalPath = m_aSaveDirED.GetText().EraseLeadingChars().EraseTrailingChars();
+    String sPhysicalPath = comphelper::string::strip(m_aSaveDirED.GetText(), ' ');
     rtl::OUString sURL;
     ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPhysicalPath, sURL );
     m_sSavePath = sURL;
diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx
index ac3be2c..5773bb3 100644
--- a/svx/source/dialog/passwd.cxx
+++ b/svx/source/dialog/passwd.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <tools/shl.hxx>
 #include <vcl/msgbox.hxx>
 
@@ -73,9 +74,7 @@ IMPL_LINK_NOARG(SvxPasswordDialog, EditModifyHdl)
 {
     if ( !bEmpty )
     {
-        String aPasswd = aRepeatPasswdED.GetText();
-        aPasswd.EraseLeadingChars().EraseTrailingChars();
-
+        String aPasswd = comphelper::string::strip(aRepeatPasswdED.GetText(), ' ');
         if ( !aPasswd.Len() && aOKBtn.IsEnabled() )
             aOKBtn.Disable();
         else if ( aPasswd.Len() && !aOKBtn.IsEnabled() )
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index c4119fd..8bc620b 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -68,6 +68,7 @@
 #include <comphelper/numbers.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/property.hxx>
+#include <comphelper/string.hxx>
 #include <connectivity/dbtools.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewfrm.hxx>
@@ -574,10 +575,9 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ )
 
             for ( size_t i=0; i<2; ++i )
             {
-                sPurePostfix = aPostfix[i];
-                sPurePostfix.EraseLeadingChars(' ');
-                sPurePostfix.EraseLeadingChars('(');
-                sPurePostfix.EraseTrailingChars(')');
+                sPurePostfix = comphelper::string::stripStart(aPostfix[i], ' ');
+                sPurePostfix = comphelper::string::stripStart(sPurePostfix, '(');
+                sPurePostfix = comphelper::string::stripEnd(sPurePostfix, ')');
                 sRealName = sFieldName;
                 sRealName += '_';
                 sRealName += sPurePostfix;
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index bd3bf23..a015f6c 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -57,6 +57,7 @@
 #include <comphelper/numbers.hxx>
 #include <comphelper/property.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
 #include <connectivity/formattedcolumnvalue.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <i18npool/lang.h>
@@ -2976,8 +2977,7 @@ sal_Bool DbFilterField::commitControl()
     if (m_aText != aText)
     {
         // check the text with the SQL-Parser
-        String aNewText(aText);
-        aNewText.EraseTrailingChars();
+        String aNewText(comphelper::string::stripEnd(aText, ' '));
         if (aNewText.Len() != 0)
         {
             ::rtl::OUString aErrorMsg;
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 08f3cf8..cbee3df 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -63,6 +63,7 @@
 #include <com/sun/star/xml/dom/DOMException.hpp>
 #include <com/sun/star/form/binding/XValueBinding.hpp>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 #include <rtl/logfile.hxx>
 
 using namespace ::com::sun::star::beans;
@@ -3116,7 +3117,7 @@ namespace svxform
     //------------------------------------------------------------------------
     IMPL_LINK_NOARG(AddConditionDialog, ResultHdl)
     {
-        String sCondition = m_aConditionED.GetText().EraseLeadingChars().EraseTrailingChars();
+        String sCondition = comphelper::string::strip(m_aConditionED.GetText(), ' ');
         String sResult;
         if ( sCondition.Len() > 0 )
         {
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 0c69784..0b27884 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -44,9 +44,9 @@
 /** === end UNO includes === **/
 
 #include <comphelper/processfactory.hxx>
-#include <svx/fmtools.hxx>
 #include <comphelper/property.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/string.hxx>
 #include <comphelper/uno3.hxx>
 #include <connectivity/dbtools.hxx>
 #include <cppuhelper/implbase1.hxx>
@@ -59,6 +59,7 @@
 #include <sfx2/request.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/fmshell.hxx>
+#include <svx/fmtools.hxx>
 #include <svx/svxids.hrc>
 #include <tools/shl.hxx>
 #include <vcl/wrkwin.hxx>
@@ -1233,9 +1234,7 @@ sal_Bool FmFilterNavigator::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUStrin
     DBG_ASSERT(((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItem),
                     "FmFilterNavigator::EditedEntry() wrong entry");
 
-    UniString aText(rNewText);
-    aText.EraseTrailingChars();
-    aText.EraseLeadingChars();
+    UniString aText(comphelper::string::strip(rNewText, ' '));
     if (aText.Len() == 0)
     {
         // deleting the entry asynchron
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index f3daa69..d3d644f 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -2562,8 +2562,8 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn
         }
     }
 
-    strFieldList.EraseTrailingChars(';');
-    sFieldDisplayNames.EraseTrailingChars(';');
+    strFieldList = comphelper::string::stripEnd(strFieldList, ';');
+    sFieldDisplayNames = comphelper::string::stripEnd(sFieldDisplayNames, ';');
 
     if (pfmscContextInfo->arrFields.empty())
     {
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index b274da8..05fdbed 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -27,6 +27,7 @@
  ************************************************************************/
 
 
+#include <comphelper/string.hxx>
 #include <svx/svdotext.hxx>
 #include "svx/svditext.hxx"
 #include <svx/svdpagv.hxx>  // for the request in Paint to see whether
@@ -998,8 +999,7 @@ void SdrTextObj::TakeObjNameSingul(XubString& rName) const
     if(pOutlinerParaObject && eTextKind != OBJ_OUTLINETEXT)
     {
         // shouldn't currently cause any problems at OUTLINETEXT
-        XubString aStr2(pOutlinerParaObject->GetTextObject().GetText(0));
-        aStr2.EraseLeadingChars();
+        XubString aStr2(comphelper::string::stripStart(pOutlinerParaObject->GetTextObject().GetText(0), ' '));
 
         // avoid non expanded text portions in object name
         // (second condition is new)
diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
index 221c674..1357330 100644
--- a/svx/source/svdraw/svdotxat.cxx
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -26,7 +26,7 @@
  *
  ************************************************************************/
 
-
+#include <comphelper/string.hxx>
 #include <svl/style.hxx>
 #include <svx/svdotext.hxx>
 #include "svx/svditext.hxx"
@@ -282,7 +282,7 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
             String aFam = pName->Copy(0, pName->Len() - 6);
 
             aFam.Erase(0,1);
-            aFam.EraseTrailingChars();
+            aFam = comphelper::string::stripEnd(aFam, ' ');
 
             sal_uInt16 nFam = (sal_uInt16)aFam.ToInt32();
 
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 9677a9b..b19c2cc 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -39,6 +39,7 @@
 #include <editeng/langitem.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/charclass.hxx>
 #include <editeng/unolingu.hxx>
@@ -272,8 +273,7 @@ SwCalc::SwCalc( SwDoc& rD )
         pLclData = new LocaleDataWrapper( xMSF, aLocale );
     }
 
-    sCurrSym = pLclData->getCurrSymbol();
-    sCurrSym.EraseLeadingChars().EraseTrailingChars();
+    sCurrSym = comphelper::string::strip(pLclData->getCurrSymbol(), ' ');
     sCurrSym  = pCharClass->lowercase( sCurrSym );
 
 static sal_Char const
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 3d571ff..ec77f94 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -2107,7 +2107,7 @@ sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext )
                                         *rAttr.GetEnd() - *rAttr.GetStart() ) );
 
                         sTxt = comphelper::string::remove(sTxt, 0x0a);
-                        sTxt.EraseLeadingChars().EraseTrailingChars();
+                        sTxt = comphelper::string::strip(sTxt, ' ');
 
                         if( sTxt.Len() )
                             aCmpPos = aPos;
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 4d0aa72..44b47a7 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -30,6 +30,7 @@
 
 #include <string.h>
 #include <float.h>
+#include <comphelper/string.hxx>
 #include <tools/datetime.hxx>
 #include <svl/svarray.hxx>
 #include <vcl/svapp.hxx>
@@ -1014,8 +1015,7 @@ _HashStr::_HashStr( const String& rName, const String& rText,
 void LookString( SwHash** ppTbl, sal_uInt16 nSize, const String& rName,
                     String& rRet, sal_uInt16* pPos )
 {
-    rRet = rName;
-    rRet.EraseLeadingChars().EraseTrailingChars();
+    rRet = comphelper::string::strip(rName, ' ');
     SwHash* pFnd = Find( rRet, ppTbl, nSize, pPos );
     if( pFnd )
         rRet = ((_HashStr*)pFnd)->aSetStr;
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index b5a4691..0c154d9 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -731,8 +731,7 @@ sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, s
             if( pCrsr->GetNext() == pCrsr )
             {
                 // einfach Selection -> Text ueberpruefen
-                String sTxt( GetSelTxt() );
-                sTxt.EraseTrailingChars();
+                String sTxt(comphelper::string::stripEnd(GetSelTxt(), ' '));
                 if( sTxt == rStr )
                     bDelTxt = bInsTxt = sal_False;
             }
@@ -787,7 +786,7 @@ sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
                                     *rAttr.GetEnd() - *rAttr.GetStart() ) );
 
                 sTxt = comphelper::string::remove(sTxt, 0x0a);
-                sTxt.EraseLeadingChars().EraseTrailingChars();
+                sTxt = comphelper::string::strip(sTxt, ' ');
 
                 if( sTxt.Len() )
                 {
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index ac17fd4..7fd61af 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -104,6 +104,7 @@
 #include <editeng/frmdiritem.hxx>
 #include <switerator.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
 
 using namespace ::com::sun::star;
 using ::rtl::OUString;
@@ -915,8 +916,8 @@ void SwXCell::setFormula(const OUString& rFormula) throw( uno::RuntimeException
         sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( sal_True );
         if(USHRT_MAX == nNdPos)
             lcl_setString( *this, OUString(), sal_True );
-        String sFml(rFormula);
-        if( sFml.EraseLeadingChars().Len() && '=' == sFml.GetChar( 0 ) )
+        String sFml(comphelper::string::stripStart(rFormula, ' '));
+        if( sFml.Len() && '=' == sFml.GetChar( 0 ) )
                     sFml.Erase( 0, 1 );
         SwTblBoxFormula aFml( sFml );
         SwDoc* pMyDoc = GetDoc();
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index c440f95..116fca8 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -27,6 +27,7 @@
  ************************************************************************/
 
 #include "hintids.hxx"
+#include <comphelper/string.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
 #include <svl/whiter.hxx>
@@ -1217,7 +1218,7 @@ void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem,
         while( nStrPos != STRING_NOTFOUND )
         {
             String aName = rName.GetToken( 0, ';', nStrPos );
-            aName.EraseTrailingChars().EraseLeadingChars();
+            aName = comphelper::string::strip(aName, ' ');
             if( !aName.Len() )
                 continue;
 
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index c72b588..389c757 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -28,6 +28,7 @@
 
 #include <hintids.hxx>
 #include <com/sun/star/i18n/ScriptType.hpp>
+#include <comphelper/string.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
 #include <sfx2/sfx.hrc>
@@ -3005,7 +3006,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO
             sRel = aURL.Copy( nPos+1 );
             aURL.Erase( nPos );
         }
-        aURL.EraseLeadingChars().EraseTrailingChars();
+        aURL = comphelper::string::strip(aURL, ' ');
 
         sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_href).append("=\"");
         rWrt.Strm() << sOut.makeStringAndClear().getStr();
diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx
index 1ee17bb..9dc4cef 100644
--- a/sw/source/filter/html/htmlbas.cxx
+++ b/sw/source/filter/html/htmlbas.cxx
@@ -27,6 +27,7 @@
  ************************************************************************/
 
 #include <hintids.hxx>
+#include <comphelper/string.hxx>
 #include <rtl/strbuf.hxx>
 #include <sfx2/sfx.hrc>
 #include <svl/svstdarr.hxx>
@@ -203,7 +204,7 @@ void SwHTMLParser::AddScriptSource()
             {
                 aBasicLib =
                     aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_library) - 1 );
-                aBasicLib.EraseLeadingChars().EraseTrailingChars();
+                aBasicLib = comphelper::string::strip(aBasicLib, ' ');
             }
         }
 
@@ -214,7 +215,7 @@ void SwHTMLParser::AddScriptSource()
             {
                 aBasicModule =
                     aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_module) - 1 );
-                aBasicModule.EraseLeadingChars().EraseTrailingChars();
+                aBasicModule = comphelper::string::strip(aBasicModule, ' ');
             }
         }
 
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index 88f6df9..a4fe67a 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -27,6 +27,7 @@
  ************************************************************************/
 
 #include <com/sun/star/i18n/ScriptType.hpp>
+#include <comphelper/string.hxx>
 #include <tools/string.hxx>
 #include <svtools/htmlkywd.hxx>
 #include <svtools/htmlout.hxx>
@@ -447,8 +448,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt )
         else if (pFldTyp->GetName() != "HTML_OFF")
             return rWrt;
 
-        String rTxt( pFld->GetPar2() );
-        rTxt.EraseLeadingChars().EraseTrailingChars();
+        String rTxt(comphelper::string::strip(pFld->GetPar2(), ' '));
         rWrt.Strm() << '<';
         if( !bOn )
             rWrt.Strm() << '/';
@@ -485,8 +485,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt )
                  '>' == rComment.GetChar(rComment.Len()-1) &&
                  rComment.Copy(0,5).EqualsIgnoreCaseAscii("HTML:") )
         {
-            String sComment( rComment.Copy(5) );
-            sComment.EraseLeadingChars();
+            String sComment(comphelper::string::stripStart(rComment.Copy(5), ' '));
             if( '<' == sComment.GetChar(0) )
             {
                 sComment = convertLineEnd(sComment, GetSystemLineEnd());
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 2a3dbf2..789292e 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -634,7 +634,7 @@ IMAGE_SETEVENT:
     }
 
     // Image-Map setzen
-    aMap.EraseTrailingChars();
+    aMap = comphelper::string::stripEnd(aMap, ' ');
     if( aMap.Len() )
     {
         // Da wir nur lokale Image-Maps kennen nehmen wireinfach alles
diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx
index cf2adc6..1bfcb6c 100644
--- a/sw/source/filter/html/parcss1.cxx
+++ b/sw/source/filter/html/parcss1.cxx
@@ -1261,8 +1261,7 @@ sal_Bool CSS1Expression::GetURL( String& rURL  ) const
     if( aValue.Len() > 5 )
     {
         rURL = aValue.Copy( 4, aValue.Len()-5 );
-        rURL.EraseTrailingChars();
-        rURL.EraseLeadingChars();
+        rURL = comphelper::string::strip(rURL, ' ');
         bRet = sal_True;
     }
 
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 703cef0..2f08194 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -1963,8 +1963,7 @@ void SwHTMLParser::NextToken( int nToken )
                 ' ' == aToken.GetChar( aToken.Len()-3 ) )
             {
                 String aComment( aToken.Copy( 3, aToken.Len()-5 ) );
-                aComment.EraseLeadingChars().EraseTrailingChars();
-                InsertComment( aComment );
+                InsertComment(comphelper::string::strip(aComment, ' '));
             }
             else
             {
@@ -3709,7 +3708,7 @@ void SwHTMLParser::NewFontAttr( int nToken )
         while( nStrPos!=STRING_NOTFOUND )
         {
             String aFName = aFace.GetToken( 0, ',', nStrPos );
-            aFName.EraseTrailingChars().EraseLeadingChars();
+            aFName = comphelper::string::strip(aFName, ' ');
             if( aFName.Len() )
             {
                 if( !bFound && pFList )
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 5886fcf..a22170c 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -136,8 +136,7 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext )
     if( !rName.Len() )
         return RTFFLD_UNKNOWN;
 
-    String sNm( rName );
-    sNm = sNm.EraseLeadingChars().GetToken(0, ' ');
+    String sNm(comphelper::string::stripStart(rName, ' ').getToken(0, ' '));
     OSL_ENSURE( sNm.Len(), "Feldname hat keine Laenge!" );
     if( !sNm.Len() )
         return RTFFLD_UNKNOWN;
@@ -208,9 +207,9 @@ public:
 };
 
 RtfFieldSwitch::RtfFieldSwitch( const String& rParam )
-    : sParam( rParam ), nCurPos( 0  )
+    : nCurPos( 0  )
 {
-    sParam.EraseTrailingChars().EraseLeadingChars();
+    sParam = comphelper::string::strip(rParam, ' ');
 }
 
 sal_Unicode RtfFieldSwitch::GetSwitch( String& rParam )
@@ -239,7 +238,7 @@ sal_Unicode RtfFieldSwitch::GetSwitch( String& rParam )
 
     sParam.Erase( 0, nCurPos + nOffset );
     rParam = sParam.GetToken( 0, c );
-    sParam.Erase( 0, rParam.Len() + nOffset ).EraseLeadingChars();
+    sParam = comphelper::string::stripStart(sParam.Erase(0, rParam.Len() + nOffset), ' ');
     if( '\\' == c )
         rParam = comphelper::string::stripEnd(rParam, ' ');
     nCurPos = 0;
@@ -869,7 +868,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
     default:
         {
             // keines von den bekannten Feldern, also eine neues UserField
-            aSaveStr.EraseLeadingChars().EraseTrailingChars();
+            aSaveStr = comphelper::string::strip(aSaveStr, ' ');
             SwUserFieldType aTmp( pDoc, aSaveStr );
             SwUserField aUFld( (SwUserFieldType*)pDoc->InsertFldType( aTmp ));
             aUFld.ChangeFormat( UF_STRING );
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 780f1f0..db1991f 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -30,7 +30,7 @@
 #undef SW_DLLIMPLEMENTATION
 #endif
 
-
+#include <comphelper/string.hxx>
 #include <tools/shl.hxx>
 #include <swtypes.hxx>
 #include <helpid.h>
@@ -753,11 +753,7 @@ void SwCaptionOptPage::SaveEntry(SvLBoxEntry* pEntry)
         if(aName == sNone)
             pOpt->SetCategory(aEmptyStr);
         else
-        {
-            aName.EraseLeadingChars (' ');
-            aName.EraseTrailingChars(' ');
-            pOpt->SetCategory(aName);
-        }
+            pOpt->SetCategory(comphelper::string::strip(aName, ' '));
         pOpt->SetNumType((sal_uInt16)(sal_uLong)aFormatBox.GetEntryData(aFormatBox.GetSelectEntryPos()));
         pOpt->SetCaption(aTextEdit.IsEnabled() ? aTextEdit.GetText() : aEmptyStr );
         pOpt->SetPos(aPosBox.GetSelectEntryPos());
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index eada5cc..6cb4473 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -102,8 +102,9 @@
 #include <com/sun/star/sdbc/ResultSetType.hpp>
 #include <com/sun/star/mail/MailAttachment.hpp>
 #include <comphelper/processfactory.hxx>
-#include <comphelper/types.hxx>
 #include <comphelper/property.hxx>
+#include <comphelper/string.hxx>
+#include <comphelper/types.hxx>
 #include <mailmergehelper.hxx>
 #include <maildispatcher.hxx>
 #include <svtools/htmlcfg.hxx>
@@ -1012,8 +1013,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
                             sLeading = aEntry.GetBase();
                         aEntry.removeSegment();
                         sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
-                        String sExt( pStoreToFilter->GetDefaultExtension() );
-                        sExt.EraseLeadingChars('*');
+                        String sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*'));
                         aTempFile = std::auto_ptr< utl::TempFile >(
                                 new utl::TempFile(sLeading,&sExt,&sPath ));
                         if( bAsSingleFile )
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 28bf2e7..d9734ee 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1684,8 +1684,7 @@ String AddressMultiLineEdit::GetAddress()
     sal_uLong  nParaCount = pTextEngine->GetParagraphCount();
     for(sal_uLong nPara = nParaCount; nPara; --nPara)
     {
-        String sPara = pTextEngine->GetText( nPara - 1);
-        sPara.EraseTrailingChars(' ');
+        String sPara = comphelper::string::stripEnd(pTextEngine->GetText(nPara - 1), ' ');
         //don't add empty trailing paragraphs
         if(sRet.Len() || sPara.Len())
         {
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index d9d96d9..2e3403e 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -35,6 +35,7 @@
 #include <mmconfigitem.hxx>
 #include <mailmergehelper.hxx>
 #include <unotools.hxx>
+#include <comphelper/string.hxx>
 #include <unotools/tempfile.hxx>
 #include <uitool.hxx>
 #include <svx/dlgutil.hxx>
@@ -126,8 +127,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
         //temp file needs it's own block
         //creating with extension is not supported by a static method :-(
         String sLeading;
-        String sExt(pSfxFlt->GetDefaultExtension());
-        sExt.EraseLeadingChars('*');
+        String sExt(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*'));
         utl::TempFile aTempFile( sLeading, &sExt );
         m_sExampleURL = aTempFile.GetURL();
         aTempFile.EnableKillingFile();
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index 3d1bae9..71c2c73 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -1315,8 +1315,8 @@ sal_Bool SwFldMgr::InsertFld(  const SwInsertFld_Data& rData )
                 SfxItemSet aBoxSet( pCurShell->GetAttrPool(),
                                 RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
 
-                String sFml( rData.sPar2 );
-                if( sFml.EraseLeadingChars().Len() &&
+                String sFml(comphelper::string::stripStart(rData.sPar2, ' '));
+                if( sFml.Len() &&
                     '=' == sFml.GetChar( 0 ) )
                     sFml.Erase( 0, 1 );
 
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 0a16423..534297a 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -57,7 +57,7 @@
 #include <com/sun/star/text/XTextEmbeddedObject.hpp>
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
-
+#include <comphelper/string.hxx>
 #include <frmui.hrc>
 #include <cption.hrc>
 #include <SwStyleNameMapper.hxx>
@@ -296,11 +296,7 @@ void SwCaptionDialog::Apply()
     if ( aName == sNone )
         aOpt.SetCategory( aEmptyStr );
     else
-    {
-        aName.EraseLeadingChars( ' ' );
-        aName.EraseTrailingChars( ' ' );
-        aOpt.SetCategory( aName );
-    }
+        aOpt.SetCategory(comphelper::string::strip(aName, ' '));
     aOpt.SetNumType( (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData( aFormatBox.GetSelectEntryPos() ) );
     aOpt.SetSeparator( aSepEdit.IsEnabled() ? aSepEdit.GetText() : String() );
     aOpt.SetNumSeparator( aNumberingSeparatorED.GetText() );
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 180c3d1..fe056ee 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -198,9 +198,7 @@ sal_uInt16 BookmarkCombo::GetSelEntryPos(sal_uInt16 nPos) const
 
     for (; nPos < nCnt; nPos++)
     {
-        String sEntry(GetText().GetToken(nPos, cSep));
-        sEntry.EraseLeadingChars();
-        sEntry.EraseTrailingChars();
+        String sEntry(comphelper::string::strip(GetText().GetToken(nPos, cSep), ' '));
         if (GetEntryPos(sEntry) != COMBOBOX_ENTRY_NOTFOUND)
             return nPos;
     }
@@ -235,10 +233,7 @@ sal_uInt16 BookmarkCombo::GetSelectEntryPos( sal_uInt16 nSelIndex ) const
         if (nSelIndex == nCnt)
         {
             sal_Unicode cSep = GetMultiSelectionSeparator();
-            String sEntry(GetText().GetToken(nPos, cSep));
-            sEntry.EraseLeadingChars();
-            sEntry.EraseTrailingChars();
-
+            String sEntry(comphelper::string::strip(GetText().GetToken(nPos, cSep), ' '));
             return GetEntryPos(sEntry);
         }
         nPos = GetNextSelEntryPos(nPos);
diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx
index f07fe52..95e6f54 100644
--- a/sw/source/ui/misc/glosdoc.cxx
+++ b/sw/source/ui/misc/glosdoc.cxx
@@ -72,8 +72,7 @@ String lcl_CheckFileName( const String& rNewFilePath,
             sRet += cChar;
         }
     }
-    sRet.EraseLeadingChars();
-    sRet.EraseTrailingChars();
+    sRet = comphelper::string::strip(sRet, ' ');
 
     sal_Bool bOk = sal_False;
     if( sRet.Len() )
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
index c6b0f22..0693340 100644
--- a/sw/source/ui/ribbar/inputwin.cxx
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -28,6 +28,7 @@
 
 #include "sal/config.h"
 
+#include <comphelper/string.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <tools/gen.hxx>
 #include <sfx2/imgmgr.hxx>
@@ -393,8 +394,7 @@ void  SwInputWindow::ApplyFormula()
 
     // Formel soll immer mit einem "=" beginnen, hier
     // also wieder entfernen
-    String sEdit( aEdit.GetText() );
-    sEdit.EraseLeadingChars().EraseTrailingChars();
+    String sEdit(comphelper::string::strip(aEdit.GetText(), ' '));
     if( sEdit.Len() && '=' == sEdit.GetChar( 0 ) )
         sEdit.Erase( 0, 1 );
     SfxStringItem aParam(FN_EDIT_FORMULA, sEdit);
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index 431de8b..5f9e7d3 100644
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -124,7 +124,7 @@
 #include <app.hrc>
 
 #include <comphelper/processfactory.hxx>
-
+#include <comphelper/string.hxx>
 #include <cppuhelper/bootstrap.hxx>
 
 #include <langhelper.hxx>
@@ -966,8 +966,7 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet)
                     {
                         String sSel(pOLV->GetSelected());
                         sSel.Erase(255);
-                        sSel.EraseTrailingChars();
-                        aHLinkItem.SetName(sSel);
+                        aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
                     }
 
                     sal_uInt16 nHtmlMode = ::GetHtmlMode(rView.GetDocShell());
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index be020a9..321ce0a 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 #include <i18npool/mslangid.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
@@ -940,8 +941,7 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
                     {
                         String sSel(pOLV->GetSelected());
                         sSel.Erase(255);
-                        sSel.EraseTrailingChars();
-                        aHLinkItem.SetName(sSel);
+                        aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
                     }
 
                     sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index 07b5622..3ad1e1f 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -30,7 +30,7 @@
 
 #define _SW_FRMVALID_HXX
 #include <hintids.hxx>
-
+#include <comphelper/string.hxx>
 #include <svl/globalnameitem.hxx>
 #include <svl/ownlist.hxx>
 #include <sfx2/frmdescr.hxx>
@@ -850,8 +850,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
                     {
                         String sReturn = rSh.GetSelTxt();
                         sReturn.Erase(255);
-                        sReturn.EraseTrailingChars();
-                        aHLinkItem.SetName(sReturn);
+                        aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
                     }
 
                     aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 93e643a..10d7fa9 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -1582,7 +1582,7 @@ String  SwView::GetSelectionTextParam( sal_Bool bCompleteWrds,
 
     GetWrtShell().GetSelectedText( sReturn );
     if( bEraseTrail )
-        sReturn.EraseTrailingChars();
+        sReturn = comphelper::string::stripEnd(sReturn, ' ');
     return sReturn;
 }
 
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx
index ebcbb35..e224320 100644
--- a/sw/source/ui/uno/unomailmerge.cxx
+++ b/sw/source/ui/uno/unomailmerge.cxx
@@ -37,6 +37,7 @@
 #include <sfx2/docfile.hxx>
 #include <sfx2/docfilt.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
 #include <vcl/timer.hxx>
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/text/MailMergeType.hpp>
@@ -787,8 +788,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
     const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
             String::CreateFromAscii( FILTER_XML ),
             SwDocShell::Factory().GetFilterContainer() );
-    String aExtension( pSfxFlt->GetDefaultExtension() );
-    aExtension.EraseLeadingChars( '*' );
+    String aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*'));
     TempFile aTempFile( C2U("SwMM"), &aExtension );
     aTmpFileName = aTempFile.GetName();
 
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index b90d3f7..a0497aa 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <svl/svstdarr.hxx>
 #include <svl/urlbmk.hxx>
 #include <tools/urlobj.hxx>
@@ -510,8 +511,8 @@ void    SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibilityChanged)
                     nMemberCount--;
                 else
                 {
-                    String aEntry(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i));
-                    aEntry.EraseLeadingChars();
+                    String aEntry(comphelper::string::stripStart(
+                        pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i), ' '));
                     SwNavigationPI::CleanEntry( aEntry );
                     SwOutlineContent* pCnt = new SwOutlineContent(this, aEntry, i, nLevel,
                                                         pWrtShell->IsOutlineMovable( i ), nPos );
diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx
index f53b4f7..827b47e 100644
--- a/sw/source/ui/utlui/navipi.cxx
+++ b/sw/source/ui/utlui/navipi.cxx
@@ -30,6 +30,7 @@
 #define NAVIPI_CXX
 
 #include <string>
+#include <comphelper/string.hxx>
 #include <svl/urlbmk.hxx>
 #include <svl/stritem.hxx>
 #include <svtools/filter.hxx>
@@ -1238,7 +1239,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt )
                 && (!sContentFileName.Len() || sContentFileName != sFileName ))
             {
                 nRet = rEvt.mnAction;
-                sFileName.EraseTrailingChars( char(0) );
+                sFileName = comphelper::string::stripEnd(sFileName, 0);
                 sContentFileName = sFileName;
                 if(pxObjectShell)
                 {
diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx
index 2071ebd..0ce1817 100644
--- a/sw/source/ui/vba/vbatemplate.cxx
+++ b/sw/source/ui/vba/vbatemplate.cxx
@@ -29,10 +29,10 @@
 #include <vbahelper/vbahelper.hxx>
 #include "wordvbahelper.hxx"
 #include "vbaautotextentry.hxx"
-#include <comphelper/processfactory.hxx>
 #include <com/sun/star/text/XAutoTextContainer.hpp>
-#include <tools/urlobj.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
+#include <tools/urlobj.hxx>
 #include <osl/file.hxx>
 
 using namespace ::ooo::vba;
@@ -51,9 +51,7 @@ String lcl_CheckGroupName( const String& rGroupName )
             sRet += cChar;
         }
     }
-    sRet.EraseLeadingChars();
-    sRet.EraseTrailingChars();
-    return sRet;
+    return comphelper::string::strip(sRet, ' ');
 }
 
 
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index 5b3f270..9ab1540 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -245,9 +245,6 @@ public:
     UniString&          Fill( xub_StrLen nCount, sal_Unicode cFillChar = ' ' );
     UniString&          Expand( xub_StrLen nCount, sal_Unicode cExpandChar = ' ' );
 
-    UniString&          EraseLeadingChars( sal_Unicode c = ' ' );
-    UniString&          EraseTrailingChars( sal_Unicode c = ' ' );
-
     UniString&          ToLowerAscii();
     UniString&          ToUpperAscii();
 
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 130f6d4..05da729 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -553,38 +553,6 @@ STRING::STRING( STRCODE c )
 
 // -----------------------------------------------------------------------
 
-STRING& STRING::EraseLeadingChars( STRCODE c )
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
-    if ( mpData->maStr[0] != c )
-        return *this;
-
-    xub_StrLen nStart = 0;
-    while ( mpData->maStr[nStart] == c )
-        ++nStart;
-
-    return Erase( 0, nStart );
-}
-
-// -----------------------------------------------------------------------
-
-STRING& STRING::EraseTrailingChars( STRCODE c )
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
-    sal_Int32 nEnd = mpData->mnLen;
-    while ( nEnd && (mpData->maStr[nEnd-1] == c) )
-        nEnd--;
-
-    if ( nEnd != mpData->mnLen )
-        Erase( static_cast< xub_StrLen >(nEnd) );
-
-    return *this;
-}
-
-// -----------------------------------------------------------------------
-
 STRING& STRING::Insert( STRCODE c, xub_StrLen nIndex )
 {
     DBG_CHKTHIS( STRING, DBGCHECKSTRING );
diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx
index 89b86de..4f64201 100644
--- a/uui/source/logindlg.cxx
+++ b/uui/source/logindlg.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include <comphelper/string.hxx>
 #include <svtools/filedlg.hxx>
 #include <vcl/msgbox.hxx>
 #include "logindlg.hxx"
@@ -214,10 +215,8 @@ void LoginDialog::EnableUseSysCredsControls_Impl( sal_Bool bUseSysCredsEnabled )
 IMPL_LINK_NOARG(LoginDialog, OKHdl_Impl)
 {
     // trim the strings
-    aNameED.SetText( aNameED.GetText().EraseLeadingChars().
-        EraseTrailingChars() );
-    aPasswordED.SetText( aPasswordED.GetText().EraseLeadingChars().
-        EraseTrailingChars() );
+    aNameED.SetText(comphelper::string::strip(aNameED.GetText(), ' '));
+    aPasswordED.SetText(comphelper::string::strip(aPasswordED.GetText(), ' '));
     EndDialog( RET_OK );
     return 1;
 }
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 15d55fe..2802c6f 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -27,6 +27,7 @@
  ************************************************************************/
 
 
+#include <comphelper/string.hxx>
 #include <unotools/syslocale.hxx>
 
 #include <svl/zforlist.hxx>
@@ -1764,7 +1765,7 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
         // #i43959# For scientific numbers, "#" in the integer part forces a digit,
         // so it has to be removed if nLeading is 0 (".00E+0", not "#.00E+0").
 
-        aNumStr.EraseLeadingChars( (sal_Unicode)'#' );
+        aNumStr = comphelper::string::stripStart(aNumStr, '#');
     }
 
     if ( nEmbeddedCount )
commit 2106d8e648449d34b195068eef5f672a14ea64a8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jun 10 21:51:19 2012 +0100

    callcatcher: update unused code
    
    Change-Id: Id5f730fc447b11000b266954f9e7f5287bad02f4

diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 3a114a9..5e9f233 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -1667,39 +1667,6 @@ sal_Bool SAL_CALL OKeySet::rowDeleted(  ) throw(SQLException, RuntimeException)
     return bDeleted;
 }
 
-::rtl::OUString OKeySet::getComposedTableName(const ::rtl::OUString& _sCatalog,
-                                              const ::rtl::OUString& _sSchema,
-                                              const ::rtl::OUString& _sTable)
-{

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list