home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows the use of Replace --->
- <HTML>
-
- <HEAD>
- <TITLE>
- Replace Example
- </TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <H3>Replace Example</H3>
-
- <P>The Replace function returns <I>string</I> with
- <I>substring1</I> being replaced by <I>substring2</I> in
- the specified scope. This is a case-sensitive search.
-
- <CFIF IsDefined("form.MyString")>
-
- <P>Your original string, <CFOUTPUT>#form.MyString#</CFOUTPUT>
- <P>You wanted to replace the substring <CFOUTPUT>#form.MySubstring1#</CFOUTPUT>
- with the substring <CFOUTPUT>#form.MySubstring2#</CFOUTPUT>.
- <P>The result: <CFOUTPUT>#Replace(form.myString, form.MySubstring1, form.mySubString2)#</CFOUTPUT>
-
-
-
- </CFIF>
-
- <FORM ACTION="replace.cfm" METHOD="POST">
- <P>String 1
- <BR><INPUT TYPE="Text" VALUE="My Test String" NAME="MyString">
-
- <P>Substring 1 (find this substring)
- <BR><INPUT TYPE="Text" VALUE="Test" NAME="MySubstring1">
-
- <P>Substring 2 (replace with this substring)
- <BR><INPUT TYPE="Text" VALUE="Replaced" NAME="MySubstring2">
-
-
- <P><INPUT TYPE="Submit" VALUE="Replace and display" NAME="">
-
- </FORM>
-
-
- </BODY>
-
- </HTML>
-
-