Is there a standard format string in ASP.NET to convert 1/2/3/... to 1st/2nd/3rd...?

Posted by Dr. Monkey on Stack Overflow See other posts from Stack Overflow or by Dr. Monkey
Published on 2010-05-28T03:13:31Z Indexed on 2010/05/28 3:21 UTC
Read the original article Hit count: 227

I have an integer in an Access database, which is being displayed in ASP.NET. The integer represents the position achieved by a competitor in a sporting event (1st, 2nd, 3rd, etc.), and I'd like to display it with a standard suffix like 'st', 'nd', 'rd' as appropriate, rather than just a naked number.

An important limitation is that this is for an assignment which specifies that no VB or C# code be written (in fact it instructs code behind files to be deleted entirely). Ideally I'd like to use a standard format string if available, otherwise perhaps a custom string (I haven't worked with format strings much, and this isn't high enough priority to dedicate significant time to*, but I am very curious about whether there's a standard string for this).

(* The assignment is due tonight, and I've learned the hard way that I can't afford to spend time on things that don't get the marks, even if they irk me significantly.)

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about integer