summaryrefslogtreecommitdiff
path: root/sal/inc/rtl/ustring.hxx
diff options
context:
space:
mode:
authorSébastien Le Ray <sebastien-libreoffice@orniz.org>2011-02-10 16:54:04 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-02-10 16:54:04 +0100
commit5765d0c90b6a7d4cb370119b3a967eb2026c1c7c (patch)
tree71b31ce271ae25b46cd5b4e5c276e7779870dac2 /sal/inc/rtl/ustring.hxx
parent2ed163062e59f817485a0ceb244f2cae9d28ce22 (diff)
Add compareToNumeric to OUString & Co
Diffstat (limited to 'sal/inc/rtl/ustring.hxx')
-rw-r--r--sal/inc/rtl/ustring.hxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index b56413d8bfbe..76bbe2668b6c 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -330,6 +330,28 @@ public:
}
/**
+ Compares two strings using natural order.
+
+ For non digit characters, the comparison use the same algorithm as
+ rtl_str_compare. When a number is encountered during the comparison,
+ natural order is used. Thus, Heading 10 will be considered as greater
+ than Heading 2. Numerical comparison is done using decimal representation.
+
+ Beware that "MyString 001" and "MyString 1" will be considered as equal
+ since leading 0 are meaningless.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+ */
+ sal_Int32 compareToNumeric( const OUString & str ) const SAL_THROW(())
+ {
+ return rtl_ustr_compare_Numeric( pData->buffer,
+ str.pData->buffer );
+ }
+
+ /**
Compares two strings with an maximum count of characters.
The comparison is based on the numeric value of each character in