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

Thousand separator blues

61 views
Skip to first unread message

Jason Bennett

unread,
Oct 1, 1998, 3:00:00 AM10/1/98
to
Hi all,

I have an edit box that a user can input a starting number, hit return and
have it update formulas in other edit boxes.
After the updates, the user can use the numbers in the other edit boxes for
more formulations.

Now here is the problem.
The numbers in the updated edit boxes hold numbers that may contain commas
or periods for thousands separators, when these
are plugged back in the application for further formulations the number is
rejected saying it is not a valid floating point number.
I can parse it and remove the commas, but it really causes problems when in
other global numbering systems, the comma is the decimal place holder.

I need to use the floattostrf because each box has different precision and
decimal placements and may need to report back an exponent.
Is there a way that I can format this to accept a floating point that has a
thousand separator in it?

Example

ts := 1000 ;
editfah.text := floattostrf (ts, ffnumber, 9, 2) ;

Output is 1,000.00

Re-inputted the number chokes.

Thanks !

--------------------------
Jason R. Bennett
Director, Information Technologies
QualTek Molecular Laboratories
http://www.qmlabs.com

Stuart C. Naifeh

unread,
Oct 1, 1998, 3:00:00 AM10/1/98
to
Parse the string and remove the characters that equal ThousandsSeparator
rather than ','. ThousandsSeparator is a variable that Delphi sets at
application start-up to whatever the thousands separator character is
according to the Windows international settings.

Regards,
Stuart


Jason Bennett wrote in message <01bded80$004105a0$18c847cf@default>...

Phil Dorcas

unread,
Oct 1, 1998, 3:00:00 AM10/1/98
to

Jason Bennett wrote in message <01bdedb0$edace540$0dc847cf@default>...
>Thanks for the info.
>
>I tried to use the ThousandsSeparator as a variable, but it said it was an
>undeclared identifier.
>DelChar : Char
>DelChar := ThousandsSeparator ;
>
>Is there a different way to call this up ?
>
>Thanks
>
>-Jason


var DelChar: char;
begin
DelChar := ThousandSeparator;
end;


This Works.
Spelling was a bit off.
Also, check SysUtils source code for more info.

Phil

Jason Bennett

unread,
Oct 2, 1998, 3:00:00 AM10/2/98
to

Carl Caulkett

unread,
Oct 2, 1998, 3:00:00 AM10/2/98
to
Jason,

Try ThousandSeparator
^^
Cheers,
Carl

Mike Orriss

unread,
Oct 2, 1998, 3:00:00 AM10/2/98
to
In article <01bdedb0$edace540$0dc847cf@default>, Jason Bennett wrote:
> I tried to use the ThousandsSeparator as a variable, but it said it was an
> undeclared identifier
>

It is ThousandSeparator and is defined in SysUtils.

Mike Orriss (m...@3kcc.co.uk)
http://www.3kcc.co.uk/notetree.htm


Jason Bennett

unread,
Oct 2, 1998, 3:00:00 AM10/2/98
to
That did it !

Thank you everyone for your help.

-Jason

Jason Bennett <jben...@qmlabs.com> wrote in article


<01bdedb0$edace540$0dc847cf@default>...
> Thanks for the info.
>

> I tried to use the ThousandsSeparator as a variable, but it said it was
an

0 new messages