Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > string.format help

Reply
Thread Tools

string.format help

 
 
java
Guest
Posts: n/a
 
      01-20-2006
I am java programmer thrust into the world of c++, wasn't that
competant in java to begin with so things just got harder. I have a
float that comes out of a database and I want to change it (to a
string) so that it is formatted to be say instead og 230000.00 to be
$230,000 Got told to use string.format but can't seem to find any
expressions that will allow me to format the string the way I want.
Any help will be appreciated.

 
Reply With Quote
 
 
 
 
feel_energetic
Guest
Posts: n/a
 
      01-20-2006
the best choice in c++ is boost::literal_cast<>
and the c-style sprintf() is an alternative approach

 
Reply With Quote
 
 
 
 
feel_energetic
Guest
Posts: n/a
 
      01-20-2006
the best choice in c++ is boost::literal_cast<>
and the c-style sprintf() is an alternative approach

 
Reply With Quote
 
java
Guest
Posts: n/a
 
      01-20-2006
Thanks for your help I ended up using FloatToStrF with ffCurrency.

 
Reply With Quote
 
red floyd
Guest
Posts: n/a
 
      01-20-2006
java <> c++ wrote:
> Thanks for your help I ended up using FloatToStrF with ffCurrency.
>


Glad your program worked, but neither of those (FloatToStrF nor
ffCurrency) are Standard C++. They are part of some third party library.

Just so you'll know.

 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      01-20-2006
java <> c++ wrote:
> I am java programmer thrust into the world of c++, wasn't that
> competant in java to begin with so things just got harder. I have a
> float that comes out of a database and I want to change it (to a
> string) so that it is formatted to be say instead og 230000.00 to be
> $230,000 Got told to use string.format but can't seem to find any
> expressions that will allow me to format the string the way I want.
> Any help will be appreciated.
>

Read up on stringstreams.

--
Ian Collins.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments