Returns count characters from string beginning at start position.
Mid(string, start, count)
Parameter |
Description |
---|---|
string |
Any string. |
start |
Starting position for count. |
count |
Number of characters to return |
<!--- This example shows the use of Mid ---> <html> <head> <title> Mid Example </title> </head> <body bgcolor = silver> <H3>Mid Example</H3> <cfif IsDefined("Form.MyText")> <!--- if len is 0, then err ---> <cfif Len(FORM.myText) is not 0> <cfif Len(FORM.myText) LTE FORM.RemoveChars> <P>Your string <cfoutput>#FORM.myText#</cFOUTPUT> only has <cfoutput>#Len(FORM.myText)#</cFOUTPUT> characters. You cannot output the <cfoutput>#FORM.removeChars# </cfoutput> middle characters of this string because it is not long enough <cfelse> <P>Your original string: <cfoutput>#FORM.myText#</cfoutput> <P>Your changed string, showing only the <cfoutput>#FORM.removeChars#</cfoutput> middle characters: <cfoutput>#Mid(Form.myText, FORM.removeChars, Form.countChars)#</cfoutput> </cfif> ...