Last active
May 3, 2022 20:00
-
-
Save thomasjslone/86d2cdcb37681cd602390cfb0a26e7b7 to your computer and use it in GitHub Desktop.
get st nd rd and th after numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def surname | |
int=self.to_s | |
if int.to_s=="0";int="0" | |
elsif int[-2..-1]=="11" or int[-2..-1] =="12" or int[-2..-1] =="13" | |
int<<"th" | |
elsif int[-1]=="1";int<<"st" | |
elsif int[-1]=="2";int<<"nd" | |
elsif int[-1]=="3";int<<"rd" | |
else;int<<"th" | |
end | |
return int | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment