by Jim Fouch (4 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Mon 10th September 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Function to add a post script to a number. th(91) will return 91st, and th(52) will return 52nd.
Optional Fmt As String = "###,###,###") As String
Dim v As Long
v = Val(Right(str(Val(S)), 2))
Select Case v
Case 1, 21, 31, 41, 51, 61, 71, 81, 91
th = "st"
Case 2, 22, 32, 42, 52, 62, 72, 82, 92
th = "nd"
Case 3, 23, 33, 43, 53, 63, 73, 83, 93
th = "rd"
Case Else
th = "th"
End Select
th = Format(S, Fmt) & th
End Function
No comments have been posted about Function to add a post script to a number. th(91) will return 91st, and th(52) will return 52nd.. Why not be the first to post a comment about Function to add a post script to a number. th(91) will return 91st, and th(52) will return 52nd..