[Clip] Re: Getting a particular word in a string
- Hugo's novel approach, while not foolproof, (and I'm sure he would be
the first to admit it) does offer one potential solution to a not
well defined problem.
For what constitutes a "word"?
Normally it's the alphabet characters of A through Z in upper or
lowercase letters. However depending upon the situation at hand that
may not always be true. For example if one was referring to the
Microsoft Office 2003 Suite software they might use the "word"
What Roy's problem does inadvertently bring out though, is the one
question any one of us must answer before we can answer his question.
That is, what is the common pattern used in his unidentified string?
What can be the delimiter that separates one "word" from the next?
If it's a single space that separates words, then Hugo's clip should
do the trick. What if it's a slash (/), or a comma? What if it's
double spaces or tab characters? What if.....well you get the idea.
So with no more information to work with, I'd say Hugo's clip offers
a very adequate potential solution to Roy's problem.
Just my 2 cents worth.
--- In firstname.lastname@example.org, Larry Thomas <larryt@c...> wrote:
> Hi Hugo,
> At 12:34 AM 2/24/04 -0000, you wrote:
> >You can put the line in an array and make the space a delimiter...
> >^!Set %Z%=^$StrTrim(^$GetLine$)$
> >^!SetListDelimiter " "
> >^!SetArray %Zetc%=^%Z%
> >^!INFO ^%Zetc0% words; word 3 is "^%Zetc3%"
> Your clip does not count words. It counts spaces. If you have a
> each word separated by a single space then it works but if you have
> sentence break which separates two sentences by a double space then
> off by the number of extra spaces and the word listed as the third
> could actually be the second word. Also a line consisting of two
> columns of information separated by spaces will display a large
> (actually spaces) and it may show nothing for the third word even
> there may be a third word in the third column.
> lrt@n... e¿ê