[EMAIL PROTECTED] wrote in message <5939@palm-dev-forum>...
>
>In a message dated 3/21/00 1:28:48 PM Eastern Standard Time,
>[EMAIL PROTECTED] writes:
>
>> > I'm using StrNCaselessCompare to compare two strings but if the strings
>> > don't start in the same way the strings don't match.
>> >
>> > Like comparing "asdf" with "sdf" using length 3 doesn't match.
>> >
>> > How can I solve this?
>>
>> As far as I know, there is no support for such comparisons in the
operating
>> system, so you'll have to write your own function to do this. You need
to
>> think about how you want to define your measure of how similar two
strings
>> are, then come up with a piece of code that answers that question. This
may
>> not be as simple as it looks. One possible measure is the length of the
>> longest common substring. This may not be the measure you want, but if
it
>> is, at least the problem is well known. You're getting into computer
>science
>> algorithm territory. Depending on the length of the strings involved,
you
>> may be able to get away with simple brute force algorithms.
>
>Dr. Dobb's had an article on string pattern matching about 10 years ago
that
>you might want to look into (boy do I feel old bringing this up).
>-Pete
>
>
If all you're after is a "find string A in string B" type of capability,
there was
an article in Scientific American ages ago (older than the DDJ article that
Pete is mentioning). I think the method is "Boyer-Moore". It really is a
great
search optimization, (but it doesn't do wildcards). Put "Boyer Moore" in
the search engines and see if anything turns up.
--
-Richard M. Hartman
[EMAIL PROTECTED]
186,000 mi/sec: not just a good idea, it's the LAW!
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html