如何将数字转换为等效字母?喜欢这个?
0 => a
1 => b
2 => c
3 => d
谢谢!
答案 0 :(得分:1)
尝试:
property letters : "abcdefghijklmnopqrstuvwxyz"
set myNumber to 0
return text (myNumber + 1) of letters
-- returns a
答案 1 :(得分: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}
答案 2 :(得分: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}