On Oct 29, 2012, at 11:46 PM, Pulkit Singhal 
<[email protected]<mailto:[email protected]>> wrote:

I was wondering if there are already utility methods present in CouchDB
1.2.0 that perform a case-insensitive comparison?

Not that I know of. You can do this by lowercasing each string and comparing 
them; or if one of the strings is a constant, you can convert it to a regexp 
and do a case-insensitive match, i.e. /foobar/i .

(In either case, you may have I18N problems, as most JS implementations seem to 
have limited Unicode support and may not be able to do this kind of 
transliteration on non-Roman letters. I’ve had trouble with this in client-side 
web scripts.)

Or you could just make sure you store normalized (e.g. lowercased) strings in 
your documents, to avoid the necessity of case-insensitive comparison.

—Jens

Reply via email to