Is there an function/algorithm to get the spelled form of any number?

I’m looking to convert any number (e.g. 1, 6, 94, 20, 1337) to the way it’s spelled in the English alphabet.

For example, if this function was called math.spelling() it would work like this.

print(math.spelling(1)) --> one
print(math.spelling(54)) --> fifty-four
print(math.spelling(432)) --> four hundred thirty-two
print(math.spelling(1337)) --> one thousand three hundred thirty-seven

Is this already a thing or would I have to manually create it?

1 Like

There isn’t one in Roblox, but you can always look one up and convert it to Lua to spare yourself some headache.

2 Likes