Mac OS X
Q: Check if a number?
I though I understood checking if a value was number or not, but I am struggling to pass the info through the if statement.
property LChar : ""
set suffix to "_2"
try
set LChar to (text of last character of suffix)
set LChar to LChar as number
end try
if suffix is equal to "" then
set suffix to "_main"
display dialog "A"
end if
if LChar is equal to number then
display dialog "B"
end if
Posted on Aug 25, 2016 4:32 AM
by Niel,Solvedanswer
Use the following:
if class of LChar is in {integer, real} then
The number class is there for converting other data to a number; no actual number will fall into that class.
(144235)
Posted on Aug 25, 2016 6:43 AM