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

[Clip] AJC's Quick Count

Expand Messages
  • Aaron
    Jody and all - In return for the help (as usual - you were great!), here s the clip that was causing me problems. It will tell you how many times a string
    Message 1 of 1 , May 1, 1999
    • 0 Attachment
      Jody and all -

      In return for the help (as usual - you were great!), here's the clip that was
      causing me problems.

      It will tell you how many times a string appears in the selected text.

      Ex: Select the following text

      this,is,a,list,of,data,items

      and run the clip on it, with "," as the search string, and it will return
      "6", because there are 6 commas.

      I needed it to run some statistics on files, but wanted just a quick way to
      do it. It's exceedingly simple, so maybe it would be good for people just
      learning to take a look at it.

      I'm sure you'll all come up with your own uses for it, as well. Makes a
      nice stocking stuffer.

      So, without further delay:

      -----------clip----------------
      AJC's QuickCount
      ^!Set %NODEBUG%=1
      ^!IfFalse ^$GetSelSize$ NoSelection

      ^!IfTrue ^%NODEBUG% SKIP
      ^!Continue String to be searched is "^%STRING%"

      ; Note: Change the comma on the next line to whatever you want your default
      ; search string to be. If you don't want a default search string, remove
      the = and ,.
      ^!Set %SEARCH%=^?{Search String?=,};%CASE%=^?{Case
      Sensitive?=_Yes^=True|No^=False};%WORD%=^?{Whole Words
      only?=Yes^=True|_No^=False}

      ^!Info ^$StrCount(^%SEARCH%;^$GetSelection$;^%CASE%;^%WORD%)$
      ^!Goto End

      :NoSelection
      ^!Info You must select some text first.

      :End
      --------------snip-------------

      Also, to Grandma Kay - thanks! I had discovered the properties you listed
      when I incorporated Jody's solution, so that's why the Set line sets all
      the parameters at
      once. Thanks for passing it along, though!

      Cheers!
      *AC*

      NEAR!....................................*far*
      -Grover

      ------------------------------------------------------------------------
      eGroup home: http://www.eGroups.com/group/ntb-clips
      http://www.eGroups.com - Simplifying group communications
    Your message has been successfully submitted and would be delivered to recipients shortly.