This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Decimal point

Help for those learning Tcl or writing their own scripts.
Post Reply
r
rayman
Voice
Posts: 4
Joined: Fri Nov 18, 2005 7:48 am
Location: Germany

Decimal point

Post by rayman »

Hello,

I would like to use the function

Code: Select all

string is double $sometest
for checking, if $sometext is double.

The problem is, that we use in Germany the comma (,) as the decimal point. :roll:

Therefore

Code: Select all

set sometext "7,44"
string is double $sometext 
returns false. Can I tell TCL to have a different decimal point?

Thanks in advance
rayman
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set double [string map {, .} $double]
and the , is replaced by a . so you can apply [string is double] on it.
r
rayman
Voice
Posts: 4
Joined: Fri Nov 18, 2005 7:48 am
Location: Germany

Post by rayman »

Thanks, it works fine 8)
Post Reply