Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing Decimal separator from US to European format

627 views
Skip to first unread message

Harsha Rao

unread,
Aug 19, 2005, 11:50:21 AM8/19/05
to

How do I change the Decimal Separator from '.' (US Format) to ',' European format in C++ Builder?

Michael Kutscher

unread,
Aug 19, 2005, 1:16:00 PM8/19/05
to
Hi,

> How do I change the Decimal Separator from '.' (US Format) to ',' European format in C++ Builder?

as simple as it could be:
DecimalSeparator=',';

best regards
Michael

Remy Lebeau (TeamB)

unread,
Aug 19, 2005, 1:06:05 PM8/19/05
to

"Harsha Rao" <har...@ti.com> wrote in message
news:4305ffbd$2...@newsgroups.borland.com...

> How do I change the Decimal Separator from '.'
> (US Format) to ',' European format in C++ Builder?

There is a global DecimalSeparator variable available. Please read the VCL
documentation for more details.

But why would you want to change it?


Gambit


Vladimir Stefanovic

unread,
Aug 19, 2005, 1:24:21 PM8/19/05
to
> But why would you want to change it?

I think that DecimalSeparator defines how the
decimal separator on NUM keyboard behaves...


--
Best regards,
Vladimir Stefanovic


Ivan Johansen

unread,
Aug 19, 2005, 2:28:54 PM8/19/05
to
Vladimir Stefanovic wrote:
> I think that DecimalSeparator defines how the
> decimal separator on NUM keyboard behaves...

No, DecimalSeparator defines how decimal values are written and parsed.

DecimalSeparator = ',';
AnsiString Str = 2.5;

Now Str will be "2,5". DecimalSeparator only affects the VCL and not
Standard Library and other libraries.

Ivan Johansen

Thomas Maeder [TeamB]

unread,
Aug 19, 2005, 4:43:04 PM8/19/05
to
"Harsha Rao" <har...@ti.com> writes:

[in addition to the response you already got]

> How do I change the Decimal Separator from '.' (US Format) to ','
> European format in C++ Builder?

The ISO C Standard has a function setlocale() ("inherited" in C++ as
std::setlocale()) that you can use to customize the way the C part of
the Standard Library deals with various things, including number
formatting.

In the Standard C++ Library, there is the locale facet std::numpunct
that you can use to customize how streams deal with number
punctuation.

0 new messages