mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
Added DCSEx.string.toStringNumber()
This commit is contained in:
parent
859db5935d
commit
f9ce72f9ae
@ -45,6 +45,20 @@ function DCSEx.string.join(table, separator)
|
||||
return joinedString
|
||||
end
|
||||
|
||||
-- TODO: description, file header
|
||||
function DCSEx.string.toStringNumber(number, firstToUpper)
|
||||
firstToUpper = firstToUpper or false
|
||||
local NUMBERS = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty" }
|
||||
|
||||
if number + 1 <= #NUMBERS then
|
||||
local str = NUMBERS[number + 1]
|
||||
if firstToUpper then str = DCSEx.string.firstToUpper(str) end
|
||||
return str
|
||||
end
|
||||
|
||||
return DCSEx.string.toStringThousandsSeparator(number)
|
||||
end
|
||||
|
||||
-- TODO: description, file header
|
||||
-- Code from https://stackoverflow.com/questions/10989788/format-integer-in-lua
|
||||
function DCSEx.string.toStringThousandsSeparator(number)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user