Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Case Insensitive Pos()?

857 views
Skip to first unread message

Robert Barr

unread,
Jul 12, 1998, 3:00:00 AM7/12/98
to
Anyone have an idea how to do a Case Insensitive Pos() on a string?

Thanks in advance!

Robert

Andreas Prucha

unread,
Jul 12, 1998, 3:00:00 AM7/12/98
to
In article <35A8E805...@unm.edu>, Robert Barr <ba...@unm.edu> wrote:
>Anyone have an idea how to do a Case Insensitive Pos() on a string?
>
Hmm, not the fastest, but it works:

x := Pos (AnsiUpperCase(String1), AnsiUpperCase(String2));

Hope this helps

Andreas

Ernie Deel

unread,
Jul 12, 1998, 3:00:00 AM7/12/98
to
Robert Barr wrote in message <35A8E805...@unm.edu>...

>Anyone have an idea how to do a Case Insensitive Pos() on a
>string?

The easy approach is to download a copy of HyperString. It has 24 different
search routines written in assembler for maximum speed and efficiency.

http://www.mindspring.com/~efd/tools.htm

--
Ernie Deel, EFD Systems
-----------------------------------------------
Everything you can imagine is real.


Martin Waldenburg

unread,
Jul 13, 1998, 3:00:00 AM7/13/98
to
Hi,

take a look at mwipos.zip on the Super Page or Torry's.

Martin

>Robert Barr schrieb:


>
> Anyone have an idea how to do a Case Insensitive Pos() on a string?
>

> Thanks in advance!
>
> Robert

Ernie Deel

unread,
Jul 14, 1998, 3:00:00 AM7/14/98
to
oz wrote in message <6of3p2$35...@forums.borland.com>...

>Aw c'mon Ernie...the easist approach it to just upper-case both string
>arguments to th POS function. Certainly easier than downloading
>a bunch of components and messing around with all that.

Ok, perhaps I should have said "the most flexible and efficent approach is
...". Upper casing both arguments will work --- slowly.

With strings, the easy approach is often the slowest and may involve a
significant amount of unnecessary overhead. For example, assume you're
looking for a word in a 200K text using the "uppercase both arguments"
approach. The actual sequence of events is something like this:

- Allocate 200K of temporary string space
- Copy 200K to the temporary string
- Uppercase the 200K temporary string
- Do the search on the temporary string using Pos()
- De-allocate the temporary string and return the resultant.

If the word happens to be located within the first sentence, this is mostly
just wasted effort. And often the next question is "How do I continue
searching for the next occurance?" to which the reply is some equally nasty
and inefficient machinations involving string splitting and a repeat of the
steps above.

An efficient, flexible, general purpose string search routine can address
all of these problems and is much easier in the long run in my opinion but
to each his own.

oz

unread,
Jul 15, 1998, 3:00:00 AM7/15/98
to
Aw c'mon Ernie...the easist approach it to just upper-case both string

arguments to th POS function. Certainly easier than downloading
a bunch of components and messing around with all that.

Oz

"Ernie Deel" <e...@remove.this.mindspring.com> wrote:

>Robert Barr wrote in message <35A8E805...@unm.edu>...

>>Anyone have an idea how to do a Case Insensitive Pos() on a
>>string?

>The easy approach is to download a copy of HyperString. It has 24 different


>search routines written in assembler for maximum speed and efficiency.

>http://www.mindspring.com/~efd/tools.htm

>--

0 new messages