summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-11 13:15:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-06-11 14:46:46 +0100
commit8f5629fd5aafc85e509a4160a11a285b0a66e7c0 (patch)
tree143883c85467b5ce9f5c665338e0f8a25067a0cd /svl
parent2106d8e648449d34b195068eef5f672a14ea64a8 (diff)
remove EraseLeadingChars and EraseTrailingChars
Change-Id: Ib9797fe97cd008cc6508ce8cec47dc5373416892
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforfind.cxx9
-rw-r--r--svl/source/numbers/zformat.cxx24
-rw-r--r--svl/source/numbers/zforscan.cxx7
3 files changed, 18 insertions, 22 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 31f9c2cb8461..5a21693a7f90 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 5efeb3efd8fa..802232a8609a 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 069d2d3941e9..c883242f7a1d 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 ) )
{