Returns the length of a string or binary object.
Len(string or binary object)
| Parameter |
Description |
|---|---|
| string |
A string or binary object |
<!--- 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>