[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Case insensitive search



On Tuesday 05 June 2001 19:55, Lars Martin wrote:
> On Fri, 1 Jun 2001 19:09:31 +0530
>
> "Shekhar" <2kshekhar@sun20.datamatics.com> wrote:
> > Hi
> >
> > How can I do a case insensitive search on the contents of a Text Node
> > using OzoneXpathQuery?
>
> Hi.
> AFAIK, XPath doesn't support case insensitive queries and with this
> Ozone doesn't support case insensitive queries because Ozone simply
> executes XPath on persistent DOM instead of in-memory DOM.

There's one way, but it's very ugly.

You can use the 'translate' function (part of XPath) to convert both strings 
to upper case (or lower case if you like it more).

A case insensitive string comparison would look like this:

translate(string1,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")=translate(string2,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")

(hope I didn't miss a letter. double check if you're going to use it.)

This results in true if string1 and string2 are equal ignoring case.
What did I say - UGLY.

regards,
Conny

-- 
______________________________________________________________________
Conny Krappatsch                              mailto:conny@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com