From 24eae2b75c201292990122e69954072f36b6f218 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 18 Feb 2013 19:46:27 +0100 Subject: add comphelper::string::indexOfAny() to replace String::SearchChar() Change-Id: If5476e94be1255247918584cf1923d408ad75064 --- comphelper/source/misc/string.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'comphelper/source/misc/string.cxx') 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(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; +} } } -- cgit