Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object >
Clib.sprintf() Method
This method writes output to a string variable according to a prescribed format.
Syntax
Clib.sprintf(stringVar, formatString, var1, var2, ..., varn)
Returns
The number of characters written into buffer if successful; otherwise, EOF.
Usage
This method formats the values in the variables according to formatString and assigns the result to stringVar. The formatString contains character combinations indicating how following parameters are to be treated. For information on format strings used with Clib.sprintf(), see Table 7 in the section Formatting Data. The string value need not be previously defined; it is created large enough to hold the result. Characters are printed as read to standard output until a percent character (%) is reached. The percent character indicates that a value is to be printed from the parameters following the format string.
Example
Each of the following lines shows an sprintf example followed by the resulting string:
var testString;
Clib.sprintf(testString, "I count: %d %d %d.",1,2,3)
//"I count: 1 2 3"
var a = 1;
var b = 2;
Clib.sprintf(testString, "%d %d %d",a, b, a+b) //"1 2 3"See Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |