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

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