From 67cf9cbeebaa258cb790e71b559586fd3299017b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 28 Oct 2011 23:07:15 +0100 Subject: add and use an OString::equalsIgnoreAsciiCaseAscii equivalent to OUString one --- sal/inc/rtl/string.hxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'sal/inc') diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index 7555464c4674..23fee9d7674e 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -396,6 +396,30 @@ public: str.pData->buffer, str.pData->length ) == 0; } + /** + Perform a ASCII lowercase comparison of two strings. + + The result is true if and only if second string + represents the same sequence of characters as the first string, + ignoring the case. + Character values between 65 and 90 (ASCII A-Z) are interpreted as + values between 97 and 122 (ASCII a-z). + Since this method is optimized for performance, the ASCII character + values are not converted in any way. The caller has to make sure that + all ASCII characters are in the allowed range between 0 and + 127. The ASCII string must be NULL-terminated. + This function can't be used for language specific comparison. + + @param asciiStr the 8-Bit ASCII character string to be compared. + @return sal_True if the strings are equal; + sal_False, otherwise. + */ + sal_Bool equalsIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const SAL_THROW(()) + { + return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, + asciiStr, rtl_str_getLength(asciiStr) ) == 0; + } + /** Perform a ASCII lowercase comparison of two strings. -- cgit