Re: Search for strings
From: Mike (vimakefile_at_yahoo.com)
Date: 07/29/04
- Next message: Kai Brinkmann [MSFT]: "Re: Error ..."
- Previous message: Mike: "Re: Search for strings"
- In reply to: cody: "Re: Search for strings"
- Next in thread: Mike: "Re: Search for strings"
- Messages sorted by: [ date ] [ thread ]
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
>
>
- Next message: Kai Brinkmann [MSFT]: "Re: Error ..."
- Previous message: Mike: "Re: Search for strings"
- In reply to: cody: "Re: Search for strings"
- Next in thread: Mike: "Re: Search for strings"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|