diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-10-28 22:37:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-11-01 09:27:22 +0000 |
commit | 489272ce9e0d655a833fa7add2ed8cfb87349edb (patch) | |
tree | de5e22f9e22b800af4cf4995572c926c196aedb7 /sal | |
parent | 9dc14818d588c13d7cea9814c8227a438c7a30de (diff) |
add and use an OString::equalsIgnoreAsciiCaseAsciiL equivalent to OUString one
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/string.hxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index 22de6dd5be5c..7555464c4674 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -397,6 +397,34 @@ public: } /** + 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 greater or equal in length as asciiStrLength. + This function can't be used for language specific comparison. + + @param asciiStr the 8-Bit ASCII character string to be compared. + @param asciiStrLength the length of the ascii string + @return sal_True if the strings are equal; + sal_False, otherwise. + */ + sal_Bool equalsIgnoreAsciiCaseAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const SAL_THROW(()) + { + if ( pData->length != asciiStrLength ) + return sal_False; + + return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, + asciiStr, asciiStrLength ) == 0; + } + + /** Match against a substring appearing in this string. The result is true if and only if the second string appears as a substring |