textfmt
textfmt |
Purpose
Create a formatted text from a string, a text or a number.
Synopsis
function textfmt(str:string, len:integer):text
function textfmt(txt:text, len:integer):text
function textfmt(i:integer, len:integer):text
function textfmt(i:integer, len:integer, flag:integer, base:integer):text
function textfmt(r:real, len:integer):text
function textfmt(r:real, len:integer, dec:integer):text
Arguments
|
str
|
String to be formatted
|
||||||
|
txt
|
Text to be formatted
|
||||||
|
i
|
Integer to be formatted
|
||||||
|
r
|
Real to be formatted
|
||||||
|
len
|
Reserved length (may be exceeded if given string is longer, in this case the string is always left justified).
|
||||||
|
flag
|
Bit encoded options:
|
||||||
|
base
|
Encoding base (between 2 and 36)
|
||||||
|
dec
|
Number of digits after the decimal point
|
Return value
Formatted text.
Example
The following:
writeln("text1", textfmt("text2",8), "text3")
writeln("text1", textfmt("text2",-8), "text3")
r:=789,123
writeln(textfmt(r,0)," ", textfmt(r,4,2), textfmt(r,8,0))
produces this output:
text1 text2text3 text1text2 text3 789,123 789,12 789
Further information
1. If the resulting string is longer than the reserved space it is not cut but printed in its entirety, overflowing the reserved space to the right.
2. When processing an integer specifying a base, the provided value is treated as an unsigned integer if the base is negative.
Related topics
Module
© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
