compareToAscii( RTL_CONSTASCII_STRINGPARAM( "something" ) )

Olivier Hallot olivier.hallot at documentfoundation.org
Thu Sep 6 05:06:54 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Em 06-09-2012 09:01, Lubos Lunak escreveu:
> On Thursday 06 of September 2012, Stephan Bergmann wrote:
>> On 09/06/2012 09:37 AM, Jan Holesovsky wrote:
>>> hunk.  In this case, the use of RTL_CONSTASCII_STRINGPARAM() kind of
>>> simulates "startsWith" (that we do not have as a method); ie. for
>>> rQAttributeName == "xmlns:SOMETHING":
>>>
>>> rQAttributeName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("xmlns:") ) ==
>>> 0
>>>
>>> but
>>>
>>> rQAttributeName.compareToAscii( "xmlns:" ) > 0
>>
>> Good catch; and the different semantics of the compareTo... overloads is
>> a horrible gotcha indeed.
> ...
>>> cases to that?  Or even better, introduce a startsWith() [or just
>>> startsWithAscii() for the optimized case] method, like we did with the
>>> isEmpty()...
>>
>> Note that "startsWith" is already covered by the various existing
>> match... functions, with a default fromIndex = 0.
> 
>  Which is rather non-obvious both when writing and reading code, 
> as 'str.match( "foo" )' intuitively suggests 'str == "foo"', so it's not 
> really good API either. I've had startsWith() on my list for quite a while, 
> so I've added it now.
> 

Hi I will check startWith() right now on this case.
Thanks
- -- 
Olivier Hallot
Founder, Board of Directors Member - The Document Foundation
The Document Foundation, Zimmerstr. 69, 10117 Berlin, Germany
Fundação responsável civilmente, de acordo com o direito civil
Detalhes Legais: http://www.documentfoundation.org/imprint
LibreOffice translation leader for Brazilian Portuguese
+55-21-8822-8812
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQSJHeAAoJEJp3R7nH3vLx2iQH/ifpZtSZB3aTbkgBlgjY1g3N
jSrBA+Hwdb+9WfPDjlici6SWzbJPsCR+4s9s+Y0LYmVAERCkMZWKy8OHJJvV2XMy
qG7XAksGph78s9Pt6aky3PE3rkuJkcNIQzjCN9eg7g0QZ7X2lbbM/OEAY6Isxm+G
nzVtR7nEACILn4J3xLeI1RgTh9zAgGE8V1oSze5Ib7zWv3vNagJJO6x+DCwOvBiT
MHbBNKI+wB2uLaKDVFeWtzxGlUO8FhHdmfvTFL9SNvuIFazhJzpmKi5omVkBtt35
i8UjQnikT7BIDBzPX50rB+ExzQXtV8RZiz4ScSKRQ3pzUWuwndzydVqaHazD1E4=
=vhWS
-----END PGP SIGNATURE-----


More information about the LibreOffice mailing list