home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / replace.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.1 KB  |  49 lines

  1. <!--- This example shows the use of Replace --->
  2. <HTML>
  3.  
  4. <HEAD>
  5. <TITLE>
  6. Replace Example
  7. </TITLE>
  8. </HEAD>
  9.  
  10. <BODY bgcolor=silver>
  11.  
  12. <H3>Replace Example</H3>
  13.  
  14. <P>The Replace function returns <I>string</I> with 
  15. <I>substring1</I> being replaced by <I>substring2</I> in
  16. the specified scope.  This is a case-sensitive search.
  17.  
  18. <CFIF IsDefined("form.MyString")>
  19.  
  20. <P>Your original string, <CFOUTPUT>#form.MyString#</CFOUTPUT>
  21. <P>You wanted to replace the substring <CFOUTPUT>#form.MySubstring1#</CFOUTPUT>
  22. with the substring <CFOUTPUT>#form.MySubstring2#</CFOUTPUT>.
  23. <P>The result: <CFOUTPUT>#Replace("#form.myString#", "#form.MySubstring1#", "#form.mySubString2#")#</CFOUTPUT>
  24.  
  25.  
  26.  
  27. </CFIF>
  28.  
  29. <FORM ACTION="replace.cfm" METHOD="POST">
  30. <P>String 1
  31. <BR><INPUT TYPE="Text" VALUE="My Test String" NAME="MyString">
  32.  
  33. <P>Substring 1 (find this substring)
  34. <BR><INPUT TYPE="Text" VALUE="Test" NAME="MySubstring1">
  35.  
  36. <P>Substring 2 (replace with this substring)
  37. <BR><INPUT TYPE="Text" VALUE="Replaced" NAME="MySubstring2">
  38.  
  39.  
  40. <P><INPUT TYPE="Submit" VALUE="Replace and display" NAME=""> 
  41.  
  42. </FORM>
  43.  
  44.  
  45. </BODY>
  46.  
  47. </HTML>       
  48.  
  49.