"Ng Wei Gee" <[EMAIL PROTECTED]> wrote
> > Which means I'm back to writing my own caseless StrStr for
> > use on the modem data, but possibly not for use on strings created
> > by PalmOS.
>
> When I used to do QuickBASIC programming, one way of tackling this problem
> was to convert the strings that you want to compare against all to
lowercase
> (or uppercase), so that you have a consistent casing to work with. I
believe
> StrToLower can accomplish that. :)
>
Yeah, but this requires that you copy the strings you're searching,
which isn't too much of a problem on desktop system but can
really cramp your style on the Palm.  Unfortunately the TxtFindString
seems to require this also making it less than perfect.

As far as building a search function goes, the Boyer-Moore algorithm
looks very cool:
http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/

This (to simplify) works from the back of the string rather than the
front and can substantially reduce the number of comparisons for
large substrings.

The other less beautiful, but still efficient approach proposed in an
archive message I don't have tagged (so can't quote the author) is
to low-case the initial letter of the substring and then do a caseless
compare along the length of the search string until you hit a match.
You can then use the caseless StrCompare to check if this hit is a
match.

It's looking like I won't need full string searching so the chance of
me implementing a Palm-efficient Boyer-Moore string search is
reducing - unless someone wants to fund it as a public good
exercise  :-)

Chris Tutty



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to