home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / removechars.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.2 KB  |  36 lines

  1. <!--- This example shows the use of RemoveChars --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>RemoveChars Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8. <BODY  bgcolor="#FFFFD5">
  9. <H3>RemoveChars Example</H3>
  10. <P>
  11. Returns a string with <I>count</I> characters
  12. removed from the specified starting position.  Returns 0
  13. if no characters are found.
  14. <CFIF IsDefined("form.myString")>
  15.     <CFIF Evaluate(form.numChars + form.start) GT Len(form.myString)>
  16.         <P>Your string is only <CFOUTPUT>#Len(form.myString)#</CFOUTPUT> characters long.
  17.         Please enter a longer string, select fewer characters to remove, or
  18.         begin earlier in the string.
  19.     <CFELSE>
  20.         <CFOUTPUT>
  21.         <P>Your original string:     #form.myString#
  22.         <P>Your modified string:    #RemoveChars(form.myString, form.start, form.numChars)#
  23.         </CFOUTPUT>
  24.     </CFIF>
  25. </CFIF>
  26.  
  27. <CFFORM ACTION="removechars.cfm" METHOD="POST">
  28. <P>Enter a string:<INPUT TYPE="Text" NAME="myString" VALUE="This is my string">
  29. <P>The number of characters to remove: <CFINPUT TYPE="Text" NAME="numChars" VALUE="3" VALIDATE="integer" REQUIRED="Yes">
  30. <P>The place in the string to start: <CFINPUT TYPE="Text" NAME="start" VALUE="3" VALIDATE="integer" REQUIRED="Yes">
  31. <P><INPUT TYPE="Submit" NAME="">
  32. </CFFORM>
  33.  
  34. </BODY>
  35. </HTML>       
  36.