jeudi 27 juillet 2017

Why do I get false when testing for first character in AppleScript?

I've searched around a few sites and here but I haven't found an answer to why when reviewing a string in AppleScript I am returned false. The following variable:

set foobar to "1234foobar"

When checking for the first character as integer:

if first character of foobar is integer then
    return true
else
    return false
end if

it returns false so I decided to check for number:

if (first character of foobar) contains number then
    return true
else
    return false
end if

it returns false so I decided to separate the first character and convert it to number before the conditional:

set firstFoo to (first character of foobar) as number
if firstFoo is equal to number then
    return true
else
    return false
end if

Why am I getting a constant false when checking for the contents of foobar?

Aucun commentaire:

Enregistrer un commentaire