Len

Returns the length of a string.

See also Left, Right, and Mid.

Syntax

Len(string)
string

Any string.

Examples

<!---  This example shows the use of Len --->
<HTML>
<HEAD>
<TITLE>
Len Example
</TITLE>
</HEAD>

<BODY bgcolor=silver>
<H3>Len Example</H3>

<CFIF IsDefined("Form.MyText")>
<!--- if len is 0, then err --->
    <CFIF Len(FORM.myText) is not 0>
    <P>Your string, <CFOUTPUT>"#FORM.myText#"</CFOUTPUT>,
    has <CFOUTPUT>#Len(FORM.myText)#</CFOUTPUT> characters.
    <CFELSE>
    <P>Please enter a string of more than 0 characters.
    </CFIF>
</CFIF>

<FORM ACTION="len.cfm" METHOD="POST">
<P>Type in some text to see the length of your string.

<BR><INPUT TYPE="Text" NAME="MyText">
<BR><INPUT TYPE="Submit" NAME="Remove characters">
</FORM>

</BODY>
</HTML>