$Center: Difference between revisions
(Automatically generated page update) |
(Automatically generated page update) |
||
Line 60: | Line 60: | ||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Media:JosrvrNew.pdf|Janus Open Server]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> |
Revision as of 22:37, 19 February 2015
Center string
Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Center function is the Center function or alias Centre.
The $Center function accepts three arguments and returns a string result that contains the first argument string, an indicated length, centered in an area with leading and trailing pad characters.
Syntax
%string = $Center(string, length, [pad])
%string is a string containing the first argument string.
The first argument is the string to be centered.
The second argument is the length of the output string. If this argument is negative or greater than 255, the request is canceled. Omitting this argument invokes a special usage of $Center, as described at the end of this section.
The third argument is a pad character to be used for centering the result string. This is an optional argument and defaults to blank.
Examples
%JUNK = $Center('PAGE TITLE', 12)
sets %JUNK to ' PAGE TITLE '
and
%JUNK = $Center('PAGE', 5)
sets %JUNK to 'PAGE '
and
%JUNK = $Center('PAGE', 1)
sets %JUNK to 'A'
and
%JUNK = $Center('PAGE', 2)
sets %JUNK to 'AG'
and
%JUNK = $Center('PAGE TITLE', 17, '-')
sets %JUNK to '---PAGE TITLE----'
.
Alternative form
There is also an alternate usage for $Center, if the second argument (length is omitted. In this case, the third argument is ignored, and the first argument must be of the form:
lenpstring
Where:
len | The first three bytes of the argument must be a decimal number which is at least as long as the string (trailing) portion of the argument. This number is used as the result length, containing the centered string. |
---|---|
p | The fourth byte of the argument is the pad character for the output. The pad characters just before and just after the centered string in the output are each replaced by a blank. |
string | The string to be centered; this can be from 1 to 251 bytes in length. |
If this form of $Center is used and any of the above restrictions are not met, the value returned by $Center is a single digit '1'. Note that this error return value is indistinguishable only to the valid invocation $Center('001p1'), where p is any pad character.