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.
--
Lubos Lunak
l.lunak@suse.cz
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.