Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     

Share This Page