Trim

Description

Returns string with leading and trailing spaces removed.

Category

String functions

Syntax

Trim(string) 

See also

LTrim, RTrim

Parameters

Parameter
Description
string
String to trim

Example

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