summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-11-15 02:02:14 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2011-11-15 02:02:52 -0500
commite786e2d25ab0105e88d7ca260c7ef4a88c9b821c (patch)
treecbeab4b56c87f944d095f1c2347b4752527ed5c1 /comphelper
parent35054d3f6213c11546200820c706c8a1527ec605 (diff)
String to rtl::OUString.
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/inc/comphelper/string.hxx3
-rw-r--r--comphelper/source/misc/string.cxx12
2 files changed, 15 insertions, 0 deletions
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 4545302b4086..620db1b8bf34 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -352,6 +352,9 @@ COMPHELPER_DLLPUBLIC inline rtl::OUStringBuffer& padToLength(
return detail::padToLength(rBuffer, nLength, cFill);
}
+COMPHELPER_DLLPUBLIC rtl::OUString removeTrailingChars(
+ const rtl::OUString& rStr, sal_Unicode cChar);
+
/** Convert a sequence of strings to a single comma separated string.
Note that no escaping of commas or anything fancy is done.
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 873a1ffe34e9..6f59564814b9 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -235,6 +235,18 @@ sal_uInt32 decimalStringToNumber(
return result;
}
+rtl::OUString removeTrailingChars(const rtl::OUString& rStr, sal_Unicode cChar)
+{
+ sal_Int32 n = rStr.getLength();
+ const sal_Unicode* p = &rStr.getStr()[n-1]; // last char
+ while (n > 0 && *p == cChar)
+ {
+ --p;
+ --n;
+ }
+ return rStr.copy(0, n);
+}
+
using namespace ::com::sun::star;
// convert between sequence of string and comma separated string