Determines the length of a string or binary object.
Number; length of a string or a binary object.
Len(string or binary object)
New in ColdFusion MX: 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.)
Parameter | Description |
---|---|
string |
A string, the name of a string, or a binary object |
<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>