Siebel eScript Language Reference > C Language Library Reference > Clib String Methods >

Clib Get Formatted String Method


The Clib Get Formatted String method returns a formatted string as a numeric literal or as an argument.

If you use this method to format a floating point number to a specific number of decimal points, then it returns the value rounded to the number of decimal points that you specify. For example, if you use the following code to format the num argument, then it returns the num argument rounded to 2 decimal points:

Clib.rsprintf("%.2f", num)

Format

Clib.rsprintf([formatString] [,var1, var2, ..., varn])

Table 155 describes the arguments for the Clib Get Formatted String method.

Table 155. Arguments for the Clib Get Formatted String Method
Argument
Description

formatString

A string that includes character combinations that describe how to treat arguments. For more information on the format strings you can use with this method, see Format Characters for Methods That Print and Scan.

var1, var2, ..., varn

Variables that this method formats according to the format that you define in the formatString argument.

Example

Each of the following code lines includes an example of using the Clib Get Formatted String method followed by the resulting string:

var TempStr = Clib.rsprintf("I count: %d %d %d.",1,2,3) //"I count: 1 2 3"
var a = 1;
var b = 2;
TempStr = Clib.rsprintf("%d %d %d",a, b, a+b) //"1 2 3"

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.