Loading ...
Sorry, an error occurred while loading the content.

[Clip] Re: Getting a particular word in a string

Expand Messages
  • John Zeman
    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.
    Message 1 of 2 , Feb 24, 2004
    • 0 Attachment
      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"

      Office11

      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.
      John



      --- In ntb-clips@yahoogroups.com, Larry Thomas <larryt@c...> wrote:
      >
      > Hi Hugo,
      >
      > At 12:34 AM 2/24/04 -0000, you wrote:
      > >Roy,
      > >
      > >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%"
      > >
      > >Hugo
      >
      > Your clip does not count words. It counts spaces. If you have a
      line with
      > each word separated by a single space then it works but if you have
      a
      > sentence break which separates two sentences by a double space then
      it is
      > off by the number of extra spaces and the word listed as the third
      word
      > could actually be the second word. Also a line consisting of two
      or more
      > columns of information separated by spaces will display a large
      word count
      > (actually spaces) and it may show nothing for the third word even
      though
      > there may be a third word in the third column.
      >
      > Regards,
      >
      > Larry
      > lrt@n... e¿ê
    Your message has been successfully submitted and would be delivered to recipients shortly.