Trim

Returns string with both leading and trailing spaces removed.

See also LTrim and RTrim.

Syntax

Trim(string)
string

String being trimmed.

Examples

<!--- This example shows the use of Trim --->
<HTML>
<HEAD>
<TITLE>
Trim Example
</TITLE>
</HEAD>

<BODY bgcolor=silver>
<H3>Trim Example</H3>

<CFIF IsDefined("FORM.myText")>
<CFOUTPUT>
<PRE>
Your string:    "#FORM.myText#"
Your string:    "#trim(FORM.myText)#"
(trimmed on both sides)
</PRE>
</CFOUTPUT>
</CFIF>

<FORM ACTION="trim.cfm" METHOD="POST">
<P>Type in some text, and it will be modified
by trim to remove leading spaces from the left and right
<P><INPUT TYPE="Text" NAME="myText" VALUE="     TEST     ">

<P><INPUT TYPE="Submit" NAME="">
</FORM>

</BODY>
</HTML>