问题描述
我想知道是否有方法或格式字符串我缺少的.NET转换如下:
I am wondering if there is a method or format string I'm missing in .NET to convert the following:
1 to 1st
2 to 2nd
3 to 3rd
4 to 4th
11 to 11th
101 to 101st
111 to 111th
<一个href="http://www.dotnet-friends.com/fast$c$c/csharp/fast$c$cincsc3bd4149-03d0-40fe-90fd-63bcee77b43e.aspx">This链接有参与编写你自己的函数的基本原则了一个坏榜样,但我更好奇,如果有一个内置的能力,我失踪了。
This link has a bad example of the basic principle involved in writing your own function, but I am more curious if there is an inbuilt capacity I'm missing.
解决方案
在Scott Hanselman的答案是公认的,因为它直接回答了这个问题。
Scott Hanselman's answer is the accepted one because it answers the question directly.
有关的解决方案然而,看到this伟大的答案。
For a solution however, see this great answer.
推荐答案
没有,还有就是.NET基础类库中没有内置的功能。
No, there is no inbuilt capability in the .NET Base Class Library.
这篇关于有没有在.NET中一个简单的方法来获得&QUOT; ST&QUOT;,&QUOT;第二&QUOT;,&QUOT; RD&QUOT;和&QUOT;日&QUOT;结尾的数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!