The Ordinal Number Function

vb.net
This is a comment thread discussing The Ordinal Number Function
  • 8 years ago
    May I offer this much simpler version: Public Function ToOrdinal(ByVal value As Integer) As String If value Mod 100 > 10 And value Mod 100 < 20 Then Return value.ToString & "th" Else Select Case value Mod 10 Case 1 Return value.ToString & "st" Case 2 Return value.ToString & "nd" Case 3 Return value.ToString & "rd" Case Else Return value.ToString & "th" End Select End If End Function

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila” - Mitch Ratcliffe