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(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
Integer to be formatted
Real to be formatted
len 
Reserved length (may be exceeded if given string is longer, in this case the string is always left justified).
<0 
Left justified within reserved space
>0 
Right justified within reserved space
Use defaults
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.123456
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
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.
Module
mmsystem


If you have any comments or suggestions about these pages, please send mail to support@fico.com.

© Copyright 2001-2013 Fair Isaac Corporation. All rights reserved.