Closed
Bug 70740
Opened 24 years ago
Closed 24 years ago
case-insensitive string comparison for nsAReadableString
Categories
(Core :: XPCOM, enhancement)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla0.9
People
(Reporter: dbaron, Assigned: scc)
References
Details
Attachments
(1 file)
4.82 KB,
patch
|
Details | Diff | Splinter Review |
It would be nice to have some way to do case-insensitive string comparison on an
nsAReadableString. Right now, AFAICT, the only ways to do it are through nsCRT
(on char* or PRUnichar*) or through nsString::EqualsIgnoreCase. This means that
if one wants to do a case-insensitive comparison of a substring of one
nsAReadableString to all of another, one must copy the substring. A good
example of where this would be useful is bug 70734.
Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Assignee | ||
Comment 2•24 years ago
|
||
Comment 3•24 years ago
|
||
sr=sfraser
Assignee | ||
Comment 5•24 years ago
|
||
fix checked in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 6•24 years ago
|
||
This was only for the ASCII subset of Unicode I guess?
Assignee | ||
Comment 7•24 years ago
|
||
The fix I checked in allowed clients to specify a comparator, a la
Compare(a, b, nsCaseInsensitiveStringComparator())
The specific comparator I mention above uses |nsCRT::strncasecmp| to compare
actual hunks, but you can supply your own if you have a more specific desire.
|strncasecmp| is the existing behavior for case insensitive comparisons (i.e.,
what |nsString| supplied before). It's original rickg code. It _looks_ to me
like it only works in the iso latin 1 subset (at least that's what the naming
leads me to believe); but you are free to provide your own comparator if this
isn't sufficient.
Updated•4 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•