summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/string.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-02-18 19:46:27 +0100
committerMichael Stahl <mstahl@redhat.com>2013-02-18 20:16:07 +0100
commit24eae2b75c201292990122e69954072f36b6f218 (patch)
tree75dadb6f93794056a7e063f1a5f5c74d1ba7dff5 /comphelper/source/misc/string.cxx
parenta413f18e5be4e95ceaf7cb4335ca9f62ec9693a5 (diff)
add comphelper::string::indexOfAny()
to replace String::SearchChar() Change-Id: If5476e94be1255247918584cf1923d408ad75064
Diffstat (limited to 'comphelper/source/misc/string.cxx')
-rw-r--r--comphelper/source/misc/string.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index d5e42468a88f..8af97dc75685 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -400,6 +400,22 @@ rtl::OString reverseString(const rtl::OString &rStr)
return tmpl_reverseString<rtl::OString, rtl::OStringBuffer>(rStr);
}
+sal_Int32 indexOfAny(rtl::OUString const& rIn,
+ sal_Unicode const*const pChars, sal_Int32 const nPos)
+{
+ for (sal_Int32 i = nPos; i < rIn.getLength(); ++i)
+ {
+ sal_Unicode const c = rIn[i];
+ for (sal_Unicode const* pChar = pChars; *pChar; ++pChar)
+ {
+ if (c == *pChar)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
} }