Skip to main content
Participant
September 3, 2009
Question

String Manipulation Help Needed.

  • September 3, 2009
  • 2 replies
  • 634 views

Hi,

I am new to coldfusion, i want to ask that is there a way we can remove a part of the string ?

like "I am really <p> new to the site.<p>I want a lots of help." I want to remove the part before the first <p> tag, Is there a way we can do it?

Help will be appreciated.

Thanks

    This topic has been closed for replies.

    2 replies

    BKBK
    Community Expert
    Community Expert
    September 3, 2009
    a way we can remove a part of the string ?
    like "I am really <p> new to the site.<p>I want a lots of help."

    There is also the aptly named removeChars function. For example, remove characters from position 1 to 16 and, since there is a tag in there, remember to format the output as HTML.

    <cfset myString = "I am really <p> new to the site.<p>I want a lots of help." >
    <cfoutput>#htmleditformat(removeChars(myString,1,16))#</cfoutput>

    Inspiring
    September 3, 2009

    And, to further demonstrate that's there's always more than one way to skin a cat, and that reading the docs is a good way to answer these questions, you might want to read up on CF's regular expression functions.

    http://livedocs.adobe.com/coldfusion/8/htmldocs/regexp_01.html#1100400

    You should be able to meet your requirements with one reReplace() call.

    --

    Adam

    Inspiring
    September 3, 2009

    The following functions will help:  Find(), Length(), Right().

    If you don't have a cfml reference manual, it's on the web.  Google "coldfusion functionname x" for functions, and "<cftagname> x" for tags.  x is the version number, and is optional.