Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
Chapter 2:  ColdFusion Functions
407
Len
Returns the length of a string or a binary object.
See also 
ToBinary
Left
Right
, and 
Mid
.
Syntax
Len(
string or binary object)
string
Any string or binary object.
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>