summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-06-06 13:36:31 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-06-06 13:36:31 +0000
commit3b36ae1376038661554d2a61e7f1b4f2c6a13e98 (patch)
tree8d512487575441876fe2c467f65078da8440c45d
parent9f32a7e47beef039b1ae81fa8b6a4770c1def7be (diff)
INTEGRATION: CWS dba30c (1.5.20); FILE MERGED
2008/05/13 06:53:56 fs 1.5.20.1: joining changes from CWS odbmacros3 to CWS dba30c 2008/04/16 20:54:43 fs 1.5.8.1: searchAndReplaceAllAsciiWithAscii
-rw-r--r--comphelper/source/misc/string.cxx25
1 files changed, 23 insertions, 2 deletions
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index cc7c30b3297a..77a251372d85 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: string.cxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
* This file is part of OpenOffice.org.
*
@@ -55,7 +55,28 @@ rtl::OUString searchAndReplaceAsciiL(
return n == -1 ? source : source.replaceAt(n, fromLength, to);
}
-COMPHELPER_DLLPUBLIC ::rtl::OUString& searchAndReplaceAsciiI(
+::rtl::OUString searchAndReplaceAllAsciiWithAscii(
+ const ::rtl::OUString& _source, const sal_Char* _from, const sal_Char* _to,
+ const sal_Int32 _beginAt )
+{
+ sal_Int32 fromLength = strlen( _from );
+ sal_Int32 n = _source.indexOfAsciiL( _from, fromLength, _beginAt );
+ if ( n == -1 )
+ return _source;
+
+ ::rtl::OUString dest( _source );
+ ::rtl::OUString to( ::rtl::OUString::createFromAscii( _to ) );
+ do
+ {
+ dest = dest.replaceAt( n, fromLength, to );
+ n = dest.indexOfAsciiL( _from, fromLength, n + to.getLength() );
+ }
+ while ( n != -1 );
+
+ return dest;
+}
+
+::rtl::OUString& searchAndReplaceAsciiI(
::rtl::OUString & _source, sal_Char const * _asciiPattern, ::rtl::OUString const & _replace,
sal_Int32 _beginAt, sal_Int32 * _replacedAt )
{