macromedia.coldfusion.advanced_techniques
[Top] [All Lists]

Re: Splitting a text string

Subject: Re: Splitting a text string
From: Ian Skinner
Date: Mon, 17 Nov 2008 14:19:08 -0800
Newsgroups: macromedia.coldfusion.advanced_techniques


Ian Skinner wrote:
<cfset string = "The quick brown fox jumped over the lazy dog">

<cfset subString = "">
<cfloop list="#string#" index="word">
  <cfset subString = subString + word>
  <cfif len(subString) GT 10>
    <cfoutput>#subString#<br/></cfoutput>
    <cfset subString = "">
  </cfif>
</cfloop>
<cfoutput>#subString#</cfoutput>

Oops forgot the delimiter parameter for the <cfloop...> tag.
<cfloop list="#string#" index="word" delimiter=" ">

<Prev in Thread] Current Thread [Next in Thread>