Re: Search for strings

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mike (vimakefile_at_yahoo.com)
Date: 07/29/04


Date: Thu, 29 Jul 2004 10:18:49 -0700


"cody" <no_spam_deutronium@gmx.net> wrote in message
news:%23tsjJwTdEHA.1656@TK2MSFTNGP09.phx.gbl...
> > > For best == least code, try:
> > > (string1+string2...).IndexOf(var1) >= 0
> > > which over-matches and is slow as it is but may do what you want for
> nice
> > > hacky test-code.

> However, such an approach wins the "sloppy, stupid and slow award" in any
> case :)

That's why I said (emphasis added):
> > and *is slow*
and
>> may do what you want for nice *hacky* test-code.

m

>
> Searching in ArrayList, Hashtable or using a switch will be better.
>
> --
> cody
>
> Freeware Tools, Games and Humour
> http://www.deutronium.de.vu || http://www.deutronium.tk
> "Jon Skeet [C# MVP]" <skeet@pobox.com> schrieb im Newsbeitrag
> news:MPG.1b72a3ebf3e6495e98b00b@msnews.microsoft.com...
> > Mike <vimakefile@yahoo.com> wrote:
> > > Depends what your def'n of best is, and when the strings get their
> values
> > > and if they're const.
> > > For best == least code, try:
> > > (string1+string2...).IndexOf(var1) >= 0
> > > which over-matches and is slow as it is but may do what you want for
> nice
> > > hacky test-code.
> >
> > No, that fails in two ways. Suppose we're trying to find "needle". It
> > doesn't appear in either of these sets:
> >
> > "aneedlea" "foo"
> >
> > or
> >
> > "nee" "dle"
> >
> > - but both of them would match.
> >
> > --
> > Jon Skeet - <skeet@pobox.com>
> > http://www.pobox.com/~skeet
> > If replying to the group, please do not mail me too
>
>



Relevant Pages

  • Olicom CrossFire 9100 software
    ... I'm searching for the system software of this ATM switch ... The switch is searching for a file named "oc9100.bin", ... olicom can't help anymore (tried to contact them, ...
    (comp.os.linux.networking)
  • Re: Gearing for flatland use
    ... spinners use over the top barrel rolling power. ... I do sometimes switch from an emphasis on down down force to front- ...
    (rec.bicycles.tech)
  • Re: Need a Switch Enclosure
    ... [snip story of searching for a box to mount a toggle switch in] ... like a cigarette pack box. ... switch and a jack and every other part of this project. ... of getting one and replacing the switch, dimensions permitting. ...
    (rec.motorcycles)
  • Re: Switch to TTY1 on Ubuntu 11.10/MacBook Pro?
    ... Question is (and searching has yeilded nothing helpful) how to switch to ... At the risk of insulting your intelligence, do you need to hit the Fn key to use F1-F12? ...
    (Ubuntu)
  • Re: Paging antonye
    ... They did some searching and found the switch for ... I asked my previously-mentioned friendly local mechanic and Ducati expert if he knew if the switch from the Elefant was a standard Ducati item. ... He said yes, ordered some for stock without looking at the price, and got a bit of a shock when the invoice turned up. ...
    (uk.rec.motorcycles)