0

如何将数字转换为等效字母?像这样?

0 => a
1 => b
2 => c
3 => d

谢谢!

4

3 回答 3

1

这不需要查找列表...

set aNum to 0
set theChar to character id (aNum + 97)

如果你也对大写字母感兴趣,这样的事情会......

set aNum to 0
set lowerCaseNum to 97
set upperCaseNum to 65

set lowercaseChar to character id (aNum + lowerCaseNum)
set uppercaseChar to character id (aNum + upperCaseNum)
return {lowercaseChar, uppercaseChar}
于 2012-10-23T22:59:07.780 回答
1

尝试:

property letters : "abcdefghijklmnopqrstuvwxyz"

set myNumber to 0
return text (myNumber + 1) of letters
-- returns a
于 2012-10-23T22:07:45.310 回答
0
on coerceNumToTime(theNum)
    set x to date ("0" as string)
    set hours of x to theNum div hours
    set minutes of x to theNum mod hours div minutes
    set seconds of x to theNum mod hours mod minutes
    return time string of x
end coerceNumToTime

set myNumber to 28
if myNumber < 26 then


    set lowerCaseNum to 97
    set upperCaseNum to 65
    set uppercaseChar to character id (myNumber + upperCaseNum)
else if myNumber > 27 then
    set myNumber to myNumber - 28

    set lowerCaseNum to 97
    set upperCaseNum to 65
    set uppercaseChar to character id (myNumber + upperCaseNum)
    set uppercaseChar to ("A" & uppercaseChar) as text

end if




return {uppercaseChar}
于 2016-07-14T09:02:11.603 回答