Formatting an IliValue Object
An
IliValue object can be formatted using the
format member function. This is shown in the following example:
IliString stringBuf;
IliFormat fmt(“#,##0.00 Yens”);
IliValue value = 5.677;
value.format(stringBuf, fmt);
IlvPrint(“Price: %s”, (const char*)stringBuf);
You can also use the
getFormatted member function, which does not require an
IliString parameter to store the result. An example is shown in the following code:
IliFormat fmt(“#,##0.00 Yens”);
IliValue value = 5.677;
const char* result = value.getFormatted(fmt);
IlvPrint(“Price: %s, result);
Note that the getFormatted member function returns its result in a static character buffer. This result must therefore be used immediately after the call.
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.