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

  1. <!--- This example shows ArrayInsertAt --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ArrayInsertAt Example</TITLE>
  5. </HEAD>
  6.  
  7. <BODY>
  8. <H3>ArrayInsertAt Example</H3>
  9.  
  10. <P>
  11. <!--- create a new array --->
  12. <CFSET DaysArray = ArrayNew(1)>
  13. <!--- populate an element or two --->
  14. <CFSET DaysArray[1] = "Monday">
  15. <CFSET DaysArray[2] = "Tuesday">
  16. <CFSET DaysArray[3] = "Thursday">
  17. <!--- add an element before position 3 --->
  18. <P>Add an element before position 3: <CFOUTPUT>#ArrayInsertAt(DaysArray,3,"Wednesday")#</CFOUTPUT>
  19. <P>Now output the array as a list:
  20. <CFOUTPUT>#ArrayToList(DaysArray)#</CFOUTPUT>
  21. <!--- Notice how the array now has four elements, and that
  22. element 3, "Thursday", has now become element four --->
  23.  
  24. </BODY>
  25. </HTML>       
  26.