CJustify()
Returns the given string justified to the center, padding out the words with spaces accordingly
CJustify( string=string, length=number );
Returns: String
| Argument | Description |
|---|---|
|
string
string,
required
|
edit
May be empty. If it is a variable that is defined as a number, the function processes it as a string. |
|
length
number,
required
|
edit
A positive integer. Length of field. |
Examples
edit string = "A light-weight dynamic scripting language for the JVM.";
dump(cJustify(string, 5));
// member function
dump(string.cJustify(5));
s = "";
res = cJustify(s, 4);
writeDump(len(res)); // length is 4
writeoutput("<pre>|#res#|</pre><hr>");
s = "abc";
res = cJustify(s, 10);
writeDump(len(res)); // length is 10
writeoutput("<pre>|#res#|</pre><hr>");
s = "10";
res = cJustify(s, 8);
writeDump(len(res)); // length is 8
writeoutput("<pre>|#res#|</pre>");
See also
- Strings
- Formatting
- string.cJustify()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)