Int2Placing Routines
Returns the "Placing" suffix for an integer, ie 1 gives 'st' as in 1st, 12 gives 'th' as in 12th, 22 gives 'nd' as in 22nd, etc.

Unit
QESBPCSConvert

Overloaded Variants
Function Int2Placing(L: LongInt): string;
Function Int2Placing(L: Int64): string;

Declaration
Function Int2Placing(L: LongInt): string;

Parameters
Value to process

Category
String/Integer Conversion Routines

Implementation

function Int2Placing (L: LongInt): string;
begin
     case abs (L) mod 10 of
          1: Result := 'st';
          2: Result := 'nd';
          3: Result := 'rd';
     else
          Result := 'th';
     end;
     case abs (L) mod 100 of
          11, 12, 13: Result := 'th';
     end;
End;

Declaration
Function Int2Placing(L: Int64): string;

Implementation

function Int2Placing (L: Int64): string;
begin
     case L mod 10 of
          1: Result := 'st';
          2: Result := 'nd';
          3: Result := 'rd';
     else
          Result := 'th';
     end;
     case L mod 100 of
          11, 12, 13: Result := 'th';
     end;
End;


HTML generated by Time2HELP
http://www.time2help.com