Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 07/13/2012 11:37 PM, Christophe JAILLET wrote:
Le 13/07/2012 23:17, Lubos Lunak a écrit :
according to my understanding,

OUString::compareToAscii(RTL_CONSTASCII_STRINGPARAM("A string")) gives
  compareAsciiL - the L means it gets the string length from the macro
I was speaking about compareToAscii, without the L. compareAsciiL does
not seem to exist anyway.
      sal_Int32 compareToAscii( const sal_Char * asciiStr, sal_Int32
maxLength ) const SAL_THROW(())

OUString str_1("abc");

str_1.compareToAscii("a")                             --> should give false
str_1.compareToAscii(RTL_CONSTASCII_STRINGPARAM("a")) --> should give
true because only the first char of the 2 strings will be compared

In fact I made the same mistake as you. RTL_CONSTASCII_STRINGPARAM made
me think about the length of the literal but in this case, it also has a
real effect on the result (unless I'm wrong :))

Indeed, see <http://cgit.freedesktop.org/libreoffice/core/commit/?id=4ad006fc76b0f7fdd267c64fc868aaf63e281a31> "Confusing behavior of cmopareToAscii overloads." That's probably the reason why Lubos left compareToAscii alone when adding the string literal overloads.

Stephan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.