close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 19 years ago

Closed 17 years ago

#396 closed defect (fixed)

FormatReal's enhancement: decimal symbol

Reported by: Alfredo Torre Owned by: danirus
Priority: highest Milestone:
Component: Text Version: head
Severity: critical Keywords:
Cc: imendez, jlaybar, jimarin

Description

Could it be posible to improve FormatReals functions (I mean FormatReal,
PutRealFormat, PutTableRealFormat) in order to let the user define the decimal
symbol? Nowadays, TOL always returns the numbers with the dot ('.') as decimal
symbol and you can't change it.

Does it make sense to add another one for the thousand symbol? Yes/No, why not?

Change History (9)

comment:1 Changed 19 years ago by Alfredo Torre

Priority: normalhighest
Severity: enhancementcritical

comment:2 Changed 19 years ago by danirus

Status: newassigned

comment:3 Changed 19 years ago by danirus

I've just add a support for this, but not in the way you ask, I mean, it is
possible to do something in the way you suggest, but it will be better done if
we force Tol to use locale settings.

In short, just to get a comma decimal separator, you only have to change the Tol
global variable called: TOL_LC_NUMERIC to a value like "Spanish". That means,
Tol will use Spanish locale data settings to format numbers.

Fredy, as soon as it's possible write some examples, play with it and tell me
something. If that's enough I will close the bug. I write here some code:


Text num = FormatReal(654321.123456);
Text TOL_LC_NUMERIC := "es_ES.UTF-8";
Text num := FormatReal(654321.123456);

Daniel

comment:4 Changed 19 years ago by danirus

I forget to say that Windows may do nothing with a locale such this:
"es_ES.UTF-8". That is for Unix/Linux platforms. For Windows it is better to use
strings such as "Spanish" or "English":
TOL_LC_NUMERIC := "Spanish";

Keep in contact.

comment:5 Changed 19 years ago by Alfredo Torre

Sorry, Daniel but I can't find TOL_LC_NUMERIC as a Tol global variable.

By the way, why don't you like (or it's not better) to improve FormatReals
functions?

Thanks

comment:6 Changed 19 years ago by imendez

Hi, one question:

  • Which are the possible values of TOL_LC_NUMERIC (over all for Windows) and

what characteristics have each possible value? I mean, I know I can put the
value "Spanish" to TOL_LC_NUMERIC, and it changes the dot by the comma, but for
example, how can I specify the dot as the thousands separator?
I want see the number 1234567.1234 as "1.234.567,1234", what should I do?

Regards.

comment:7 Changed 19 years ago by danirus

Hi Iván,

We must use this two characters: %' at the beggining of the Text format
parameter (or in RealFormat Tol global variable), but there are problems in many
"sprintf" function implementations.

We've decided to implement our own flavor to patch it up.
Now its supposed to be automatic. It should be tested. Probably it will be
running tomorrow, in our fancy critical nightly-built version. I will be out for
several days (Sunday I'll be back), but Josp could repair whatever problem this
code emerge. I hope none.

Cheers.

comment:8 Changed 18 years ago by Víctor de Buen Remiro

bug_file_loc: http://www.tol-project.org

comment:9 Changed 17 years ago by Víctor de Buen Remiro

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.