Left - MACROMEDIA COLDFUSION MX 61-CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION MX 61-CFML:
Table of Contents

Advertisement

Left

Description
Returns the leftmost count characters in a string.
Returns
String; the first count characters in the string parameter.
Category
String functions
Function syntax
Left(string, count)
See also
Right, Mid,
Len
Parameters
Parameter
string
count
Example
<h3>Left Example</h3>
<cfif IsDefined("Form.MyText")>
<!--- if len is 0, then err --->
<cfif Len(form.myText) is not 0>
<cfif Len(form.myText) LTE form.RemoveChars>
<p>Your string <cfoutput>#form.myText#</cfoutput>
only has <cfoutput>#Len(form.myText)#</cfoutput>
characters. You cannot output the <cfoutput>#form.removeChars#</
cfoutput>
leftmost characters of this string because it is not long enough
<cfelse>
<p>Your original string: <cfoutput>#form.myText#</cfoutput>
<p>Your changed string, showing only the <cfoutput>#form.removeChars#
</cfoutput> leftmost characters:
<cfoutput>#Left(Form.myText, form.removeChars)#</cfoutput>
</cfif>
<cfelse>
<p>Please enter a string
</cfif>
</cfif>
<form action="#CGI.ScriptName#" method="POST">
<p>Type in some text
<br>
<input type="Text" name="MyText">
<p>How many characters from the left do you want to show?
<select name="RemoveChars">
<option value="1">1
<option value="3" selected>3
<option value="5">5
<option value="7">7
558
Chapter 3: ColdFusion Functions
Description
A string or a variable that contains one.
A positive integer or a variable that contains one. Number of characters to return.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents