Article View: borland.public.cppbuilder.nativeapi
Article #6296Re: format question
From: Karim
Date: Tue, 24 May 2005 14:35
Date: Tue, 24 May 2005 14:35
25 lines
1448 bytes
1448 bytes
Thanks JD,
What about if I want to change the number after the point in two numbers? 12.3 becomes 000012.30
Thanks
"JD" <nospam@nospam.com> wrote:
>
>"Karim" <Karim@noemail.com> wrote:
>>
>>is there any API to convert a string or an int to a specific format? For example:
>>my input: 12.3 output: 000012.3
>> 345.9 000345.9
>
>That can be accomplished using sprintf or AnsiString.sprintf:
>
> // assumes Buffer is a char*
> sprintf( Buffer, "%06f", SomeFloat );
>
> // assumes Buffer is an AnsiString
> Buffer.sprintf("%06f", SomeFloat );
>
>~ JD
>
Technical Details
Message-ID:
<42933ba8$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4292f5a8$1@newsgroups.borland.com> <42931256$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3b7f7b4a56d80b10 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Karim" <karim@noemail.com> Sender: "Karim" <karim@noemail.com> Reply-To: "Karim" <karim@noemail.com> Subject: Re: format question Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 193.173.109.1 References: <4292f5a8$1@newsgroups.borland.com> <42931256$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <42933ba8$1@newsgroups.borland.com> Date: 24 May 2005 07:35:20 -0700 X-Trace: newsgroups.borland.com 1116945320 207.105.83.66 (24 May 2005 07:35:20 -0700) Lines: 26 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail