Whatever message this page gives is out now! Go check it out!

CJustify

Last update:
May 18, 2026

Description

Centers a string in a field length.

Returns

String, center-justified by adding spaces before or after the input parameter. If length is less than the length of the input parameter string, the string is returned unchanged.

Category

Function syntax

Cjustify(string, length)

See also

Parameters

Parameter
Description
string
A string or a variable that contains one. May be empty. If it is a variable that is defined as a number, the function processes it as a string.
length
A positive integer or a variable that contains one. Length of field.Can be coded as:
  • A number; for example, 6
  • A string representation of a number; for example, "6" Any other value causes ColdFusion to throw an error.

Example

<CFOUTPUT>
    <cfset OriginalString="ColdFusion"/>
    <B>Original String (quoted):</B> "#OriginalString#"<BR>
    <B>Center-justified String (quoted):</B> "#CJustify("ColdFusion", 20)#"
</CFOUTPUT>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page