TRealFormat

Login to reply to this topic.
Wed, 2008-04-16 16:59
Joined: 2008-04-10
Forum posts: 4

STL stringstream class provides a fill() method which allows to have strings formated w/ 'a fill character' if the the length of the input is below a certain threshold.

i.e.

stringstream ss;
ss.width(10);
ss.fill('0');
float x = 100.12345678910;
ss << x;

output -> 000100.123

Is there a way to format the input of a RBuf8 to do the same using TRealFromat.
TRealFormat format;
aValue 100.130232;

Rbuf8 string;
string.AppendNum(aValue, format);

I know there is format.iplaces, and format.iWidth, but Can't seem to figure this one out w/ out a work around -->
if(aValue < 9)
append( '0');

Please advise.
Cheers!


OwnerOfTheWorld

  • Login to reply to this topic.