Any suggestion for CF5.0 instead of CFMX.

Ketan Patel
G3 Technology Group, LLC
Graphics III Advertising, Inc.
(410)789-7007 or (800)783-1799
"It's Not Creative if it doesn't Sell."
http://www.g3group.com <http://www.g3group.com>

  -----Original Message-----
  From: Tim Blair [mailto:[EMAIL PROTECTED]
  Sent: Friday, October 17, 2003 8:00 AM
  To: CF-Talk
  Subject: RE: number of occurrences in a string.

  > I am looking for which returns the number of occurrences of a word in
  a
  > string. It should return the word occurrence count when I pass a word
  to
  > search in a string.

  Try this (watch the wrap):

  <cffunction name="wordcount" returntype="numeric" output="yes"
  hint="Counts the number of occurences of a given word in a given
  string">
      <cfargument name="word" type="string" required="yes" hint="The word
  to look for">
      <cfargument name="line" type="string" required="yes" hint="The
  string to search through">
      <cfset var wordarray =
  refind("[^[:alpha:]](#arguments.word#)[^[:alpha:]]", arguments.line, 1,
  TRUE)>
      <cfif NOT wordarray.len[1]>
          <cfreturn 0>
      </cfif>
      <cfreturn arraylen(wordarray.len)>
  </cffunction>

  HTH,

  Tim.

  -------------------------------------------------------
  OUR NEW SITE IS NOW LIVE
  Visit our new website at http://www.rawnet.com/ and
  race around the beautiful Bracknell streets at
  http://xmas.rawnet.com/
  -------------------------------------------------------
  Tim Blair
  Web Application Engineer, Rawnet Limited
  Direct Phone : +44 (0) 1344 393 441
  Switchboard : +44 (0) 1344 393 040
  -------------------------------------------------------
  This message may contain information which is legally
  privileged and/or confidential.  If you are not the
  intended recipient, you are hereby notified that any
  unauthorised disclosure, copying, distribution or use
  of this information is strictly prohibited. Such
  notification notwithstanding, any comments, opinions,
  information or conclusions expressed in this message
  are those of the originator, not of rawnet limited,
  unless otherwise explicitly and independently indicated
  by an authorised representative of rawnet limited.
  -------------------------------------------------------


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to