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

  1. <!--- This example shows the use of Insert --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. Insert Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BODY bgcolor=silver>
  12.  
  13. <H3>Insert Example</H3>
  14.  
  15.  
  16. <CFIF IsDefined("form.myString")>
  17. <!--- if the position is longer than the length of
  18. the string, err --->
  19. <CFIF form.insertPosition GT Len(MyString)>
  20.  
  21.     <CFOUTPUT>
  22.     <P>This string only has #Len(MyString)#
  23.     characters; therefore, you cannot insert the substring
  24.     #form.mySubString# at position #form.insertPosition#.
  25.     </CFOUTPUT>
  26. <CFELSE>
  27.  
  28.     <CFOUTPUT>
  29.     <P>You inserted the substring #form.MySubstring# into the 
  30.     string #form.MyString#, resulting in the following 
  31.     string:<BR>#Insert("#form.MySubString#","#form.myString#","#form.insertposition#")#
  32.     </CFOUTPUT>
  33. </CFIF>
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. </CFIF>
  42.  
  43.  
  44.  
  45. <P>This function will insert a substring into a
  46. string after a specified character position.
  47.  
  48. <FORM ACTION="insert.cfm" METHOD="POST">
  49. <P>Type a string
  50. <BR><INPUT TYPE="Text" NAME="MyString" VALUE="abcdefg">
  51. <P>And a substring to insert
  52. <BR><INPUT TYPE="Text" NAME="MySubString" VALUE="1234">
  53. <P>And the position at which to insert it
  54. <BR><SELECT NAME="InsertPosition">
  55.     <OPTION VALUE="1">1
  56.     <OPTION VALUE="2" SELECTED>2
  57.     <OPTION VALUE="3">3
  58.     <OPTION VALUE="4">4
  59.     <OPTION VALUE="5">5
  60.     <OPTION VALUE="6">6
  61.     <OPTION VALUE="7">7
  62.     <OPTION VALUE="8">8
  63.     <OPTION VALUE="9">9
  64.     <OPTION VALUE="10">10
  65. </SELECT>
  66.  
  67. <INPUT TYPE="Submit" NAME="show the example">
  68.  
  69.  
  70. </FORM>
  71.  
  72.  
  73.  
  74.  
  75. </BODY>
  76.  
  77. </HTML>       
  78.