# Add Ordinal Extension to a Number

This little code snippet adds extensions such as st, nd, rd, th to integer numbers. Useful also with SSRS under Report Properties > Code

``` Public Function ChangeToOrdinal(ByVal digit As Integer) As String
Dim residual As Integer = digit Mod 10
Dim extension As String
If digit > 20 Or digit < 10 Then
Select Case residual
Case Is = 1
extension = "st"
Case Is = 2
extension = "nd"
Case Is = 3
extension = "rd"
Case Else
extension = "th"
End Select
Else
extension = "th"
End If
Return CStr(digit) & extension
End Function
```

### Related Posts

Comments are closed.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6127812,"math_prob":0.8996505,"size":551,"snap":"2021-21-2021-25","text_gpt3_token_len":147,"char_repetition_ratio":0.19744058,"word_repetition_ratio":0.020408163,"special_character_ratio":0.25589836,"punctuation_ratio":0.042105265,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97062826,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-06-20T18:41:12Z\",\"WARC-Record-ID\":\"<urn:uuid:b95728b1-5971-42f3-b6fe-80ab7180e12b>\",\"Content-Length\":\"40274\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7f3ca1fe-ebb7-4994-b816-bcc11968dde0>\",\"WARC-Concurrent-To\":\"<urn:uuid:897402cc-e0b4-4f44-80c1-0acdb7096aa1>\",\"WARC-IP-Address\":\"74.208.236.107\",\"WARC-Target-URI\":\"https://williameduardo.com/development/ssrs/add-ordinal-extension-to-number/\",\"WARC-Payload-Digest\":\"sha1:YREQRJ5J5EJGHLSDT6WH4YRTSMR46NZU\",\"WARC-Block-Digest\":\"sha1:PW5DJJOK3DN7VI4VFUEVZA2M2LTSQCMI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-25/CC-MAIN-2021-25_segments_1623488253106.51_warc_CC-MAIN-20210620175043-20210620205043-00391.warc.gz\"}"}