User Guide
560 Chapter 3: ColdFusion Functions
Len
Description
Determines the length of a string or binary object.
Returns
Number; length of a string or a binary object.
Category
String functions
Function syntax
Len(string or binary object)
See also
ToBinary, Left, Right, Mid
History
ColdFusion MX: Changed Unicode support: ColdFusion supports the Java UCS-2
representation of Unicode character values 0–65535. (ColdFusion 5 and earlier releases supported
ASCII values 1–255. When calculating a length, some string-processing functions processed the
ASCII 0 (NUL) character, but did not process subsequent characters of the string.)
Parameters
Example
<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">
<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>
Parameter Description
string A string, the name of a string, or a binary object