summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-10-14 12:34:49 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-10-14 14:22:55 +0200
commit6d2a9697c9933133539773af6d493a42c6fb94a9 (patch)
tree020c95028bcb9c42dd6a7a8f6b7d392bbd1b6c99 /comphelper
parent8195c98dbabc01a11fa2dd73fefabcd6d331d7cf (diff)
Remove unused comphelper::string::reverseString overload
Change-Id: Ic1c56c7be9804685fd37b8f6a13aaab039e07afa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141361 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/qa/string/test_string.cxx4
-rw-r--r--comphelper/source/misc/string.cxx27
2 files changed, 9 insertions, 22 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index 0a9850ed920f..0b2f3ee05479 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -178,9 +178,9 @@ void TestString::testTokenCount()
void TestString::testReverseString()
{
- OString aOut = ::comphelper::string::reverseString("ABC");
+ OUString aOut = ::comphelper::string::reverseString(u"ABC");
- CPPUNIT_ASSERT_EQUAL(OString("CBA"), aOut);
+ CPPUNIT_ASSERT_EQUAL(OUString("CBA"), aOut);
}
void TestString::testSplit()
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 4fcd00078bfe..95e936e60142 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -518,29 +518,16 @@ bool isdigitAsciiString(std::u16string_view rString)
[](sal_Unicode c){ return rtl::isAsciiDigit(c); });
}
-namespace
-{
- template <typename T, typename I, typename O> T tmpl_reverseString(I rIn)
- {
- if (rIn.empty())
- return T();
-
- typename I::size_type i = rIn.size();
- O sBuf(static_cast<sal_Int32>(i));
- while (i)
- sBuf.append(rIn[--i]);
- return sBuf.makeStringAndClear();
- }
-}
-
OUString reverseString(std::u16string_view rStr)
{
- return tmpl_reverseString<OUString, std::u16string_view, OUStringBuffer>(rStr);
-}
+ if (rStr.empty())
+ return OUString();
-OString reverseString(std::string_view rStr)
-{
- return tmpl_reverseString<OString, std::string_view, OStringBuffer>(rStr);
+ std::size_t i = rStr.size();
+ OUStringBuffer sBuf(static_cast<sal_Int32>(i));
+ while (i)
+ sBuf.append(rStr[--i]);
+ return sBuf.makeStringAndClear();
}
sal_Int32 indexOfAny(std::u16string_view rIn,