Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Append Ordinal TLC

Discussion in 'Information Technology' started by James A. Fortune, Jul 28, 2006.

  1. James A. Fortune

    James A. Fortune
    Expand Collapse



    I wrote:

    >> Hopefully this works for numbers larger than 31 also. I'm not sure I
    >> haven't missed any. I'm feeling too lazy to nest some IIf functions or
    >> to use the switch() function.

    >> James A. Fortune
    >> MPAPoser@FortuneJames.com

    >BTW, I tried the function and it needs some TLC.

    After some TLC:

    Public Function AppendOrdinal(lngX As Long) As String
    Dim intLastDigit As Integer

    AppendOrdinal = ""
    intLastDigit = Val(Right(CStr(lngX), 1))
    Select Case intLastDigit
    Case 1: AppendOrdinal = "st"
    Case 2: AppendOrdinal = "nd"
    Case 3: AppendOrdinal = "rd"
    Case 0, 4 To 9: AppendOrdinal = "th"
    End Select
    If CLng(Right(CStr(lngX), 2)) >= 11 And CLng(Right(CStr(lngX), 2)) <= 13
    Then AppendOrdinal = "th"
    End Function

    James A. Fortune

    In reality the texts of the Rosetta Stone were of limited use because
    the hieroglyphs were so damaged, as Champollion had pointed out in his
    'Lettre à M. Dacier': 'The hieroglyphic text of the Rosetta inscription,
    which should have lent itself so happily to this research, because of
    its breaks only presented the single name of Ptolemy.' Having become
    the focus of attention for would-be decipherers, the Rosetta Stone still
    remains a powerful popular symbol, even though its inscriptions failed
    to fulfil the hopes and expectations they aroused. Other inscriptions
    and papyri were far more important in providing clues to decipherment.
    -- The Keys of Egypt, Lesley and Roy Adkins, ISBN 0-06-095349-7
Since you're here... we have a small favor to ask...     Become a Supporter      ::     Make a Contribution     

Share This Page