Len

Description

Returns the length of a string or binary object.

Category

String functions

Syntax

Len(string or binary object) 

See also

ToBinary, Left, Right, Mid

Parameters

Parameter
Description
string
A string or binary object

Example

<!--- 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>