Home All Groups Group Topic Archive Search About

Good way to do lookups...

Author
2 Jun 2006 4:08 AM
BobRoyAce
Let's say that I have a table with like 525 records where each record
contains a string to look for and a string to replace with (e.g.
AVENUE, AVE). What I need to do is parse through a string (a street
address) and then for each "word/token" found, I want to look it up and
replace it if I find it in one of the 525 records. I have two
questions...

1) Is there an easy way to tokenize a string (i.e. split it out into
its separte words, where words are separated by a space)? For example,
tokenizing "Eden Hill Str" would result in three "words": "Eden",
"Hill", and "Str".

2) What would be the best way to facilitate searching for each token?
One way to do it would be to use a dataset and then there's probably
some kind of lookup function I could use (which would take advantage of
primary key field which we are actually looking up). Is that the best
way or is there a better one?

Author
2 Jun 2006 5:24 AM
Cor Ligthert [MVP]
Bob,

You say it yourself use the string.split to create arrays of words.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemstringclasssplittopic.asp

Know that there are more split methods and as well much overloaded methods.

The opposite from the split is the join

http://msdn2.microsoft.com/en-us/library/57a79xd0.aspx

I hope this helps,

Cor


Show quoteHide quote
"BobRoyAce" <b***@omegasoftwareinc.com> schreef in bericht
news:1149221336.394612.306470@f6g2000cwb.googlegroups.com...
> Let's say that I have a table with like 525 records where each record
> contains a string to look for and a string to replace with (e.g.
> AVENUE, AVE). What I need to do is parse through a string (a street
> address) and then for each "word/token" found, I want to look it up and
> replace it if I find it in one of the 525 records. I have two
> questions...
>
> 1) Is there an easy way to tokenize a string (i.e. split it out into
> its separte words, where words are separated by a space)? For example,
> tokenizing "Eden Hill Str" would result in three "words": "Eden",
> "Hill", and "Str".
>
> 2) What would be the best way to facilitate searching for each token?
> One way to do it would be to use a dataset and then there's probably
> some kind of lookup function I could use (which would take advantage of
> primary key field which we are actually looking up). Is that the best
> way or is there a better one?
>
Author
2 Jun 2006 2:52 PM
BobRoyAce
Thanks...how 'bout item #2...any thoughts?