summaryrefslogtreecommitdiff
path: root/comphelper/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-02-15 15:26:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-02-15 15:41:09 +0100
commit9ab0b38e95133dab720408cc2c80093b8a201c10 (patch)
tree416dde227ed5c4ded99292feb94f36a64c327999 /comphelper/source
parent42422f2599220b678aa41c4aadeec28df113c3ec (diff)
Various string function clean up
Added: * rtl::OString::matchL * rtl::OString::endsWith * rtl::OString::endsWithL * rtl::OString::indexOfL * rtl::OString::replaceFirst * rtl::OString::replaceAll * rtl::OString::getToken * rtl::OUString::endsWith * rtl::OUString::replaceFirst * rtl::OUString::replaceFirstAsciiL * rtl::OUString::replaceFirstAsciiLAsciiL * rtl::OUString::replaceAll * rtl::OUString::replaceAllAsciiL * rtl::OUString::replaceAllAsciiLAsciiL * rtl::OUString::getToken plus underlying C functions where necessary Deprecated: * comphelper::string::remove * comphelper::string::getToken Removed: * comphelper::string::searchAndReplaceAsciiL * comphelper::string::searchAndReplaceAllAsciiWithAscii * comphelper::string::searchAndReplaceAsciiI * comphelper::string::replace * comphelper::string::matchL * comphelper::string::matchIgnoreAsciiCaseL * comphelper::string::indexOfL Also fixed some apparent misuses of RTL_CONSTASCII_USTRINGPARAM -> RTL_CONSTASCII_STRINGPARAM.
Diffstat (limited to 'comphelper/source')
-rw-r--r--comphelper/source/misc/string.cxx120
1 files changed, 0 insertions, 120 deletions
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 8514a83872c6..3547de626318 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -48,126 +48,6 @@
namespace comphelper { namespace string {
-rtl::OUString searchAndReplaceAsciiL(
- rtl::OUString const & source, char const * from, sal_Int32 fromLength,
- rtl::OUString const & to, sal_Int32 beginAt, sal_Int32 * replacedAt)
-{
- sal_Int32 n = source.indexOfAsciiL(from, fromLength, beginAt);
- if (replacedAt != NULL) {
- *replacedAt = n;
- }
- return n == -1 ? source : source.replaceAt(n, fromLength, to);
-}
-
-::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 )
-{
- 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;
-}
-
-namespace
-{
- template <typename T, typename O> T tmpl_replace(const T &rIn,
- const T &rSearch, const T &rReplace)
- {
- if (rIn.isEmpty() || rSearch.isEmpty())
- return rIn;
-
- O aRet;
-
- sal_Int32 nFromIndex = 0;
- while (nFromIndex < rIn.getLength())
- {
- sal_Int32 nIndex = rIn.indexOf(rSearch, nFromIndex);
- if (nIndex == -1)
- {
- aRet.append(rIn.copy(nFromIndex));
- break;
- }
- aRet.append(rIn.copy(nFromIndex, nIndex-nFromIndex));
- aRet.append(rReplace);
- nFromIndex = nIndex+rSearch.getLength();
- }
-
- return aRet.makeStringAndClear();
- }
-}
-
-rtl::OString replace(const rtl::OString &rIn, const rtl::OString &rSearch,
- const rtl::OString &rReplace)
-{
- return tmpl_replace<rtl::OString, rtl::OStringBuffer>(rIn, rSearch,
- rReplace);
-}
-
-rtl::OUString replace(const rtl::OUString &rIn, const rtl::OUString &rSearch,
- const rtl::OUString &rReplace)
-{
- return tmpl_replace<rtl::OUString, rtl::OUStringBuffer>(rIn, rSearch,
- rReplace);
-}
-
-namespace
-{
- template <typename T, typename C, typename O> T tmpl_remove(const T &rIn,
- const C cRemove)
- {
- if (rIn.isEmpty())
- return rIn;
-
- O aRet;
-
- for (sal_Int32 i = 0; i < rIn.getLength(); ++i)
- {
- C cChar = rIn[i];
- if (cChar != cRemove)
- aRet.append(cChar);
- }
-
- return aRet.makeStringAndClear();
- }
-}
-
-rtl::OString remove(const rtl::OString &rIn, sal_Char c)
-{
- return tmpl_remove<rtl::OString, sal_Char, rtl::OStringBuffer>(rIn, c);
-}
-
-rtl::OUString remove(const rtl::OUString &rIn, sal_Unicode c)
-{
- return tmpl_remove<rtl::OUString, sal_Unicode, rtl::OUStringBuffer>(rIn, c);
-}
-
namespace
{
template <typename T, typename C> T tmpl_stripStart(const T &rIn,