Skip to main content
Inspiring
November 10, 2008
Answered

how do you limit the amount of words outputted

  • November 10, 2008
  • 5 replies
  • 1687 views
I'm having a difficult time figuring out how to limit the amount of words to be outputted. I have code that limits the amount of characters output but I can't figure out how to limit the amount of words to be output.

here's the code to limit the amount of characters output.

    This topic has been closed for replies.
    Correct answer xstortionist
    http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=130

    this is the answer I was looking for.

    Thank you all! I greatly appreciate it!

    5 replies

    xstortionistAuthorCorrect answer
    Inspiring
    November 10, 2008
    http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=130

    this is the answer I was looking for.

    Thank you all! I greatly appreciate it!
    Inspiring
    November 10, 2008
    google "<cfloop>". The 1st offering should be the section of the cfml reference manual you want. Look up the part where it says loop through a list.
    Inspiring
    November 10, 2008
    This looks even better for your solution:

    http://www.cflib.org/udf/FullLeft

    --
    Ken Ford
    Fordwebs, LLC
    Adobe Community Expert - Dreamweaver/ColdFusion
    Adobe Certified Expert - Dreamweaver CS3
    Adobe Certified Expert - ColdFusion 8
    http://www.fordwebs.com
    http://www.cfnoob.com


    "Ken Ford - *ACE*" <newsgroups2@fordwebs.com> wrote in message
    news:gf9jo5$9td$1@forums.macromedia.com...
    > This works pretty good:
    >
    > http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=130
    >
    > --
    > Ken Ford
    > Fordwebs, LLC
    > Adobe Community Expert - Dreamweaver/ColdFusion
    > Adobe Certified Expert - Dreamweaver CS3
    > Adobe Certified Expert - ColdFusion 8
    > http://www.fordwebs.com
    > http://www.cfnoob.com
    >
    >
    > "xstortionist" <webforumsuser@macromedia.com> wrote in message
    > news:gf9gui$65k$1@forums.macromedia.com...
    >> I'm having a difficult time figuring out how to limit the amount of words
    >> to be
    >> outputted. I have code that limits the amount of characters output but I
    >> can't
    >> figure out how to limit the amount of words to be output.
    >>
    >> here's the code to limit the amount of characters output.
    >>
    >>
    >>
    >> <CFIF LEN(aroundtown) gt 725>
    >> <CFSET aroundtown2 = LEFT(aroundtown,725)>
    >> </CFIF>
    >>
    >

    Inspiring
    November 10, 2008
    This works pretty good:

    http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=130

    --
    Ken Ford
    Fordwebs, LLC
    Adobe Community Expert - Dreamweaver/ColdFusion
    Adobe Certified Expert - Dreamweaver CS3
    Adobe Certified Expert - ColdFusion 8
    http://www.fordwebs.com
    http://www.cfnoob.com


    "xstortionist" <webforumsuser@macromedia.com> wrote in message
    news:gf9gui$65k$1@forums.macromedia.com...
    > I'm having a difficult time figuring out how to limit the amount of words
    > to be
    > outputted. I have code that limits the amount of characters output but I
    > can't
    > figure out how to limit the amount of words to be output.
    >
    > here's the code to limit the amount of characters output.
    >
    >
    >
    > <CFIF LEN(aroundtown) gt 725>
    > <CFSET aroundtown2 = LEFT(aroundtown,725)>
    > </CFIF>
    >

    Inspiring
    November 10, 2008
    Treat your string as a space delimited list and output the number of elements you want.
    Inspiring
    November 10, 2008
    I'm not sure I understand what you mean here. Could you provide me with sample code of how to delimited list?