Centers a string in a field length.
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.
Display and formatting functions, String functions
Cjustify(string,length)
|
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:
Any other value causes ColdFusion to throw an error. |
<!--- This example shows how to use CJustify. --->
<CFPARAM name = "jstring" DEFAULT = "">
<cfif IsDefined("FORM.submit")>
<cfdump var="#Form#">
<cfset jstring = Cjustify("#FORM.justifyString#", 35)>
</cfif>
<html>
<head>
<title>CJustify Example</title>
</head>
<body>
<h3>CJustify</h3>
<p>Enter a string; it will be center-justified within the sample field.
<form action = "cjustify.cfm" method="post">
<p><input type = "Text" value = "<cfoutput>#jString#</cfoutput>"
size = 35 name = "justifyString">
<p><input type = "Submit" name = "submit">
<input type = "RESET">
</form>
</body>
</html>
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_c-d_05.html
Comments
David Buhler said on Dec 5, 2007 at 12:35 PM :