How to test for a number

Rob Cozens rcozens at pon.net
Wed Mar 16 11:52:30 EST 2005


Hi Klaus,

>Any hints on how to do this on win and a mac?

I gave up trying some time ago, and settled on my numberEditMask custom 
property + handler logic to open a dialog substack to set the property if 
it doesn't exist in the calling stack.

Transcript should be able to return the system number format just as it can 
return the system date format.

FYI, it's possible to determine the system date in xTalks by:

function systemDateFormat
   put "1999,1,9,0,0,0,0" into testDate
   convert testDate to short system date -- MC pads day/month regardless of 
settings
   put 2 into characterNumber
   repeat while char characterNumber of testDate is in "1,9"
     add 1 to characterNumber
   end repeat
   put char characterNumber of testDate into dateSeparator
   put empty into returnDateFormat
   set the itemDelimiter to dateSeparator
   repeat for each item datePart in testDate
     if datePart > 9 then
       if datePart > 99 then put "y" after returnDateFormat
       put "y" after returnDateFormat
     else if datePart > 1 then
       if length(datePart) > 1 then put "d" after returnDateFormat
       put "d" after returnDateFormat
     else
       if length(datePart) > 1 then put "m" after returnDateFormat
       put "m" after returnDateFormat
     end if
   end repeat
   return returnDateFormat&dateSeparator
end systemDateFormat

If one could find a way to get a known numeric value from the system in 
system display format, this same logic could be used; but I never found one.

Rob Cozens CCW
Serendipity Software Company

"And I, which was two fooles, do so grow three;
  Who are a little wise, the best fooles bee."

  from "The Triple Foole" by John Donne (1572-1631) 



More information about the use-livecode mailing list