Initializing help system before first use

# strfmt

Purpose
Create a formatted string from a string or a number.
Synopsis
`function strfmt(str:string,len:integer):string`
`function strfmt(i:integer, len:integer):string`
`function strfmt(r:real, len:integer):string`
`function strfmt(r:real, len:integer, dec:integer):string`
Arguments

str | String 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).
<0 | Left justified within reserved space
>0 | Right justified within reserved space
0 | Use defaults
dec | Number of digits after the decimal point

Return value
Formatted string.
Example
The following:

    writeln("text1", strfmt("text2",8), "text3")
    writeln("text1", strfmt("text2",-8), "text3")
    r:=789.123456
    writeln(strfmt(r,0)," ", strfmt(r,4,2), strfmt(r,8,0))

produces this output:

    text1     text2text3
    text1text2     text3
    789.123 789.12        789

Further information
1. This function creates a formatted string from a string or an integer or real number. It can be used at any place where strings may be used. Its most likely use is for generating printed output (in combination with write and writeln).
2. 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.
Related topics
write, writeln.
Parent Topic Predefined functions and procedures

© 2001-2026 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.