Re: Number of Decimal Places
Re: Number of Decimal Places
- Subject: Re: Number of Decimal Places
- From: Matthew Stuckwisch <email@hidden>
- Date: Mon, 22 Apr 2002 16:59:03 -0500
For instance, "1" would be 0, "1.1" would be 2, "1.11" would be 3, etc.
well, whoops, I accidently forgot that in mine a whole number shows up as
"1"
Well, I can do it by adding one line and editting one of your lines if
you don't make me set the TID back.
Make that adding one lines, and doubling/editting one of yours.
set x to (the text returned of (display dialog "Number:" default
answer "")) as real
set AppleScript's text item delimiters to "."
if x = (round x) then display dialog "The numer of decimal places of " &
(x as string) & " is 0."
if x /= (round x) then display dialog "The number of decimal places
of " & x & " is " & (length of (text item 2 of (x as string)))
Otherwise I have to add one more line
set x to (the text returned of (display dialog "Number:" default
answer "")) as real
set {oldTID, AppleScript's text item delimiters} to {AppleScript's text
item delimiters, "."}
if x = (round x) then display dialog "The numer of decimal places of " &
(x as string) & " is 0."
if x /= (round x) then display dialog "The number of decimal places
of " & x & " is " & (length of (text item 2 of (x as string)))
set AppleScript's text item delimiters to oldTID
Matthew Stuckwisch
[AIM/MSN]{GuifaSwimmer} | [Yahoo!]{SapphireTree} | [ICQ]{137477701}
[IRC]{guifa / G}(esperNET / irc.massinova.com)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.