diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-08-29 11:22:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-08-29 11:43:50 +0100 |
commit | cbba41823a2e67add2620e4901bf0ead542c2932 (patch) | |
tree | 921e608e0b72f88d0acfe48b7953bb4c37205799 /svl | |
parent | Related: #i113785# add regression test for ligatures (diff) | |
download | core-cbba41823a2e67add2620e4901bf0ead542c2932.tar.gz core-cbba41823a2e67add2620e4901bf0ead542c2932.zip |
String::Expand -> string::padToLength
Change-Id: I684e371c31ba76d2e9b563eed70449764346161b
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 15 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 16 |
2 files changed, 19 insertions, 12 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 83ac5f345a4e..6d0cbdc93551 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1122,14 +1122,16 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) nPat += nLen - 1; else if (nPat + nLen > rPat.getLength() && sStrArray[nNext].GetChar(nLen-1) == ' ') { + using namespace comphelper::string; // Trailing blanks in input. - String aStr(comphelper::string::stripEnd(sStrArray[nNext], ' ')); + OUStringBuffer aBuf(stripEnd(sStrArray[nNext], ' ')); // Expand again in case of pattern "M. D. " and // input "M. D. ", maybe fetched far, but.. - aStr.Expand( rPat.getLength() - nPat, ' '); + padToLength(aBuf, rPat.getLength() - nPat, ' '); + OUString aStr = aBuf.makeStringAndClear(); bOk = (rPat.indexOf( aStr, nPat) == nPat); if (bOk) - nPat += aStr.Len() - 1; + nPat += aStr.getLength() - 1; } } break; @@ -1196,9 +1198,10 @@ bool ImpSvNumberInputScan::SkipDatePatternSeparator( sal_uInt16 nParticle, xub_S { // The same ugly trailing blanks check as in // IsAcceptedDatePattern(). - String aStr(comphelper::string::stripEnd(sStrArray[nNext], ' ')); - aStr.Expand( rPat.getLength() - nPat, ' '); - bOk = (rPat.indexOf( aStr, nPat) == nPat); + using namespace comphelper::string; + OUStringBuffer aBuf(stripEnd(sStrArray[nNext], ' ')); + padToLength(aBuf, rPat.getLength() - nPat, ' '); + bOk = (rPat.indexOf( aBuf.makeStringAndClear(), nPat) == nPat); } if (bOk) { diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 8c30d2442390..5cf224ba451e 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2774,9 +2774,11 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, sSecStr = comphelper::string::stripStart(sSecStr, '.'); if ( bInputLine ) { - sSecStr = comphelper::string::stripEnd(sSecStr, '0'); - if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) ) - sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' ); + using namespace comphelper::string; + OUStringBuffer aBuf(stripEnd(sSecStr, '0')); + if (aBuf.getLength() < rInfo.nCntPost) + padToLength(aBuf, rInfo.nCntPost, '0'); + sSecStr = aBuf.makeStringAndClear(); ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); nCntPost = sSecStr.Len(); } @@ -3491,9 +3493,11 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, sSecStr = comphelper::string::stripStart(sSecStr, '.'); if ( bInputLine ) { - sSecStr = comphelper::string::stripEnd(sSecStr, '0'); - if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) ) - sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' ); + using namespace comphelper::string; + OUStringBuffer aBuf(stripEnd(sSecStr, '0')); + if (aBuf.getLength() < rInfo.nCntPost) + padToLength(aBuf, rInfo.nCntPost, '0'); + sSecStr = aBuf.makeStringAndClear(); ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); nCntPost = sSecStr.Len(); } |