Compare Page Revisions
« Older Revision - Back to Page History - Current Revision
public static string ToOrdinal(this int input) { var mod100 = input % 100; var mod10 = input % 10; var result = input.ToString(); if (mod10 == 1 & mod100 != 11) result += "st"; else if (mod10 == 2 & mod100 != 12) result += "nd"; else if (mod10 == 3 & mod100 != 13) result += "rd"; else result += "th"; return result; }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.