mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
utils.str.nth
This commit is contained in:
parent
229990e130
commit
7deadddbe8
@ -308,6 +308,19 @@ def nItems(n, item, between=None):
|
|||||||
else:
|
else:
|
||||||
return format('%s %s %s', n, between, item)
|
return format('%s %s %s', n, between, item)
|
||||||
|
|
||||||
|
def nth(i):
|
||||||
|
i = int(i)
|
||||||
|
if i % 100 in (11,12,13):
|
||||||
|
return 'th'
|
||||||
|
test = i % 10
|
||||||
|
if test == 1:
|
||||||
|
return 'st'
|
||||||
|
if test == 2:
|
||||||
|
return 'nd'
|
||||||
|
if test == 3:
|
||||||
|
return 'rd'
|
||||||
|
return 'th'
|
||||||
|
|
||||||
def be(i):
|
def be(i):
|
||||||
"""Returns the form of the verb 'to be' based on the number i."""
|
"""Returns the form of the verb 'to be' based on the number i."""
|
||||||
if i == 1:
|
if i == 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user