%Library.Utilityabstract class %Library.Utility
Handy utility functions
Center text on a line
Show the date, for example Sep 26 2003
Show date and time, for example: Sep 26 2003 5:39 PM
Used for formatting database and global sizes in MB Returns a minimum of two significant digits
FormatReference performs the same operations as FormatString, except the input is a local or global variable reference, in $NAME() format, and the formatting is applied separately to each subscript value.
Format a string, replacing unprintable characters with $C(nn) and showing $Lists with $LB(). $Bit strings are shown with $C() or $ZWC() and with a comment indicating which bits are set. %Status values are shown with $LB() and a comment describing the error.
Flags contains these options:
1 - Do the formatting with $C(), $LB(), and $ZWC(). If this bit is not set, the string is returned unchanged. The formatted value may be used in a SET command to reproduce the string.
2 - Add escape sequences to make the added formatting characters Bold.
4 - Write the formatted string to the current output device.
8 - Do not add a comment to $BIT() strings and %Status values.
The overflow argument is set to 1 if the formatted string has to be truncated because it is too long for a local variable.
Searches in Source the occurrences of FindWhat and replaces them with ReplaceWith.
The Search will be case insensitive if MatchCase=0 (default = 1).
The result of the operation will be placed in OutputString.
The method returns the number of times the replacement occurred.
You can also specify a starting point for the search (Start) and how many occurrences of
FindWhat you want replaced (default: 0 = All).
If FindWhat is the empty string, no replacement occurs. StartMode specifies how the Start parameter works. If StartMode=0, Start is a character count like in $Find. If StartMode=1, Start is a FindWhat count. That is, replacing starts at the beginning of the Start-th piece delimited by FindWhat. If Start<0, the find/replace operation works backwards from the end of the string. If Start is passed byref, return value of Start is where next search of the same line should start from, i.e. 1 character after the last replace.
Show the time, for example 6:33 PM