summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-03-06 19:00:24 +0000
committerKurt Zenker <kz@openoffice.org>2008-03-06 19:00:24 +0000
commit868f7a54f560e35768e078488fa286d2ae44df52 (patch)
tree7e3c7dec67ff92e2566dbe933eb874e6899b3144
parent48328e7989ea79d3d0badcfac3ab5f8a0622aec9 (diff)
INTEGRATION: CWS odbmacros2 (1.2.10); FILE MERGED
2008/03/04 12:12:32 fs 1.2.10.2: RESYNC: (1.2-1.3); FILE MERGED 2008/01/23 14:18:19 fs 1.2.10.1: +searchAndReplaceAsciiI
-rw-r--r--comphelper/source/misc/string.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 822dd0057ff3..1ba1d4174654 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: string.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: obo $ $Date: 2008-02-26 15:14:25 $
+ * last change: $Author: kz $ $Date: 2008-03-06 20:00:24 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -37,6 +37,7 @@
#include "sal/config.h"
#include <cstddef>
+#include <string.h>
#include <vector>
#include "comphelper/string.hxx"
@@ -46,7 +47,7 @@
namespace comphelper { namespace string {
-rtl::OUString searchAndReplace(
+rtl::OUString searchAndReplaceAsciiL(
rtl::OUString const & source, char const * from, sal_Int32 fromLength,
rtl::OUString const & to, sal_Int32 beginAt, sal_Int32 * replacedAt)
{
@@ -57,6 +58,21 @@ rtl::OUString searchAndReplace(
return n == -1 ? source : source.replaceAt(n, fromLength, to);
}
+COMPHELPER_DLLPUBLIC ::rtl::OUString& searchAndReplaceAsciiI(
+ ::rtl::OUString & _source, sal_Char const * _asciiPattern, ::rtl::OUString const & _replace,
+ sal_Int32 _beginAt, sal_Int32 * _replacedAt )
+{
+ sal_Int32 fromLength = strlen( _asciiPattern );
+ sal_Int32 n = _source.indexOfAsciiL( _asciiPattern, fromLength, _beginAt );
+ if ( _replacedAt != NULL )
+ *_replacedAt = n;
+
+ if ( n != -1 )
+ _source = _source.replaceAt( n, fromLength, _replace );
+
+ return _source;
+}
+
// convert between sequence of string and comma separated string
::rtl::OUString convertCommaSeparated(