• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Number of Decimal Places
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Number of Decimal Places


  • Subject: Number of Decimal Places
  • From: Goldfish <email@hidden>
  • Date: Mon, 22 Apr 2002 16:00:37 -0400

Hi. Here is an open challenge:

I would like to, in the fewest lines of code, determine the number of decimal places of a "real" named x.
For instance, "1" would be 0, "1.1" would be 2, "1.11" would be 3, etc.
Using the following guide, I'd like to know who can come up with the fewest lines of code to return the correct number of decimal places:

--Use this code:
set x to (the text returned of (display dialog "Number:" default answer "")) as real
--Code
display dialog "The number of decimal places of " & x & " is " & decimalplaces

Good luck.

-Goldfish
_______________________________________________
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.

  • Follow-Ups:
    • Re: Number of Decimal Places
      • From: Deivy Petrescu <email@hidden>
    • Re: Number of Decimal Places
      • From: Doug McNutt <email@hidden>
    • Re: Number of Decimal Places
      • From: email@hidden (Michael Sullivan)
    • Re: Number of Decimal Places
      • From: Matthew Stuckwisch <email@hidden>
  • Prev by Date: RE: MacOS: Making 6,000 barcodes
  • Next by Date: Re: Deafult or optional arguments to handlers
  • Previous by thread: Re: applescript-users digest, Vol 3 #375 - 14 msgs
  • Next by thread: Re: Number of Decimal Places
  • Index(es):
    • Date
    • Thread