<!--- This example shows the use of Insert --->

<HTML>

<HEAD>
<TITLE>
Insert Example
</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">

<H3>Insert Example</H3>


<CFIF IsDefined("form.myString")>
<!--- if the position is longer than the length of
the string, err --->
<CFIF form.insertPosition GT Len(MyString)>

	<CFOUTPUT>
	<P>This string only has #Len(MyString)#
	characters; therefore, you cannot insert the substring
	#form.mySubString# at position #form.insertPosition#.
	</CFOUTPUT>
<CFELSE>

	<CFOUTPUT>
	<P>You inserted the substring #form.MySubstring# into the 
	string #form.MyString#, resulting in the following 
	string:<BR>#Insert(form.MySubString, form.myString, form.insertposition)#
	</CFOUTPUT>
</CFIF>







</CFIF>



<P>This function will insert a substring into a
string after a specified character position.

<FORM ACTION="insert.cfm" METHOD="POST">
<P>Type a string
<BR><INPUT TYPE="Text" NAME="MyString" VALUE="abcdefg">
<P>And a substring to insert
<BR><INPUT TYPE="Text" NAME="MySubString" VALUE="1234">
<P>And the position at which to insert it
<BR><SELECT NAME="InsertPosition">
	<OPTION VALUE="1">1
    <OPTION VALUE="2" SELECTED>2
    <OPTION VALUE="3">3
    <OPTION VALUE="4">4
    <OPTION VALUE="5">5
    <OPTION VALUE="6">6
    <OPTION VALUE="7">7
    <OPTION VALUE="8">8
    <OPTION VALUE="9">9
    <OPTION VALUE="10">10
</SELECT>

<INPUT TYPE="Submit" NAME="show the example">


</FORM>




</BODY>

</HTML>       
