ASP.NET 中是否有标准格式字符串可将 1/2/3/... 转换为 1st/2nd/3rd...?
我在 Access 数据库中有一个整数,该整数正在 ASP.NET 中显示。整数代表运动员在体育赛事中获得的位置(第一、第二、第三等),我想用标准后缀(如适当的“st”、“nd”、“rd”来显示它) ,而不仅仅是一个赤裸裸的数字。
一个重要的限制是,这是针对指定不编写 VB 或 C# 代码的赋值(实际上,它指示完全删除文件后面的代码)。理想情况下,我想使用标准格式字符串(如果可用),否则可能使用自定义字符串(我没有太多使用格式字符串,并且这没有足够高的优先级来投入大量时间*,但我很好奇关于是否有一个标准字符串)。
(*作业将于今晚到期,我已经惨痛地认识到,我不能把时间花在没有得到分数的事情上,即使它们让我非常恼火。)
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.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,没有标准格式字符串可以做到这一点。但写起来并不难:
Unfortunately, there is no standard format string to do this. But it's not that hard to write:
你可以试试这个
You could try this