ord() function
Publié : sam. avr. 13, 2019 7:26 pm
Hello, I am coding a prg that converts a number between 0 and 9 to a subscript character, but it seems that the ORD command only operates between 0 and 255 =(
char(8320) >"₀"
ord("₀") > 8320
toSubscript(n)
n
0 > "₀"
1 > "₁"
2 > "₂"
3 > "₃"
... ₄₅₆₇₈₉
Code : Tout sélectionner
def toSubscript(n):
local subscriptStr
DispG
if ord(string(n))>=48 and ord(string(n))<=57:
subscriptStr := char(n+8272) # char(n+48)
return subscriptStr, ord(subscriptStr), asc(subscriptStr)
else:
return "error"
ord("₀") > 8320
toSubscript(n)
n
0 > "₀"
1 > "₁"
2 > "₂"
3 > "₃"
... ₄₅₆₇₈₉