summaryrefslogtreecommitdiff
path: root/l10ntools/source/helper.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'l10ntools/source/helper.hxx')
-rw-r--r--l10ntools/source/helper.hxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/l10ntools/source/helper.hxx b/l10ntools/source/helper.hxx
index 5b20595f9490..de70c0268701 100644
--- a/l10ntools/source/helper.hxx
+++ b/l10ntools/source/helper.hxx
@@ -56,6 +56,21 @@ inline sal_Int32 searchAndReplace(
return i;
}
+inline void searchAndReplaceAll(
+ rtl::OString * text, rtl::OString const & search,
+ rtl::OString const & replace)
+{
+ assert(text != 0);
+ for (sal_Int32 i = 0;;) {
+ i = text->indexOf(search, i);
+ if (i == -1) {
+ break;
+ }
+ *text = text->replaceAt(i, search.getLength(), replace);
+ i += replace.getLength();
+ }
+}
+
inline rtl::OString getToken(
rtl::OString const & text, sal_Int32 token, char separator)
{
@@ -63,6 +78,23 @@ inline rtl::OString getToken(
return text.getToken(token, separator, i);
}
+inline sal_Int32 indexOfAnyAsciiL(
+ rtl::OUString const & text, char const * chars, sal_Int32 charsLen,
+ sal_Int32 index = 0)
+{
+ for (; index != text.getLength(); ++index) {
+ sal_Unicode c = text[index];
+ if (c <= 0x7F
+ && (rtl_str_indexOfChar_WithLength(
+ chars, charsLen, static_cast< char >(c))
+ != -1))
+ {
+ return index;
+ }
+ }
+ return -1;
+}
+
}
#endif