Centers a string in a given field length by adding spaces to either side.

cJustify(string, length) → returns string

Argument Reference

string string

The string that is to be centered

length numeric

The length of the field in which the string should be centered

Sample code invoking the cJustify function

<cfset jstring = cJustify("ColdFusion", 35)> 
 <cfdump var="#jstring#" />   

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub