User Guide Cancel

Trim

 

Description

Removes leading and trailing spaces and control characters from a string.

Returns

A copy of the string parameter, after removing leading and trailing spaces and control characters.

Category

String functions

Function syntax

Trim(string)
Trim(string)
Trim(string)

See also

LTrimRTrim

Parameters

Parameter

Description

string

A string or a variable that contains a string.

Example

<cfscript>
string=" This is a typical Hello World string "
writeOutput(Trim(string))
</cfscript>
<cfscript> string=" This is a typical Hello World string " writeOutput(Trim(string)) </cfscript>
<cfscript>
    string="    This is a typical      Hello World    string       "
    writeOutput(Trim(string))
</cfscript>

Get help faster and easier

New user?

Adobe MAX 25

Adobe MAX

The Creativity Conference

Oct 28–30 Los Angeles and online

Adobe MAX

The Creativity Conference

Oct 28–30 Los Angeles and online

Adobe MAX 25

Adobe MAX

The Creativity Conference

Oct 28–30 Los Angeles and online

Adobe MAX

The Creativity Conference

Oct 28–30 Los Angeles and online