STR.Default

Previous  Next

 

new-string = STR.Default( strIn       AS STRING, 

                          strTemplate AS STRING,

                          param       AS INTEGER|REAL|STRING ) AS STRING

 


 

Returns a string created  using the template and a parameter if the strIn is empty.  The parameter can be of type INTEGER, REAL or STRING.  Current version only support a single parameter.  The template can contain the same formatting directives as the FORMAT function.

 

The strIn parameter can be NULL and can therefor be used with ENVIRONMENT variables.  If the specified ENVIRONMENT variable has not been assigned, the the default will be returned.

 

Example:

 

$LIBRARY "MyBASIC2_ExtLib"

 

PRINT STR.Default( "", "Kalle Anka is %d years old", 123 ),

PRINT STR.Default( "", "Kalle Anka owes me $%1.3f", 123313.12 ),

PRINT STR.Default( "", "Kalle Anka %s", "is cute" ),

 

END