summaryrefslogtreecommitdiff
path: root/include/rtl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-01-14 10:59:34 +0200
committerTor Lillqvist <tml@collabora.com>2021-01-14 18:06:58 +0100
commit06ecfbe3d236e06f597e5422bfc24a9a76c3f90c (patch)
tree8dd90fd4eb614542c57bdd91c0e02cf8c2029362 /include/rtl
parent51d9f9069a45030eec4f49b40f736ac4f97c0e9e (diff)
Introduce startsWithAsciiL() to match endsWithAsciiL()
Will be used in an upcoming change. Unit test included. Change-Id: I777a755cab543ea277b84fb5ad021d0b91725764 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109264 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'include/rtl')
-rw-r--r--include/rtl/ustring.hxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index ee3cfe170555..3a7f8bd5654f 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -1420,6 +1420,26 @@ public:
}
/**
+ Check whether this string starts with a given ASCII string.
+
+ @param asciiStr a sequence of at least asciiStrLength ASCII characters
+ (bytes in the range 0x00--0x7F)
+ @param asciiStrLength the length of asciiStr; must be non-negative
+ @return true if this string starts with asciiStr; otherwise, false is
+ returned
+
+ @since LibreOffice 7.2
+ */
+ bool startsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
+ const
+ {
+ return asciiStrLength <= pData->length
+ && rtl_ustr_asciil_reverseEquals_WithLength(
+ pData->buffer, asciiStr,
+ asciiStrLength);
+ }
+
+ /**
Check whether this string starts with a given string, ignoring the case of
ASCII letters.