Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我确信这很简单,但如果我需要像这样使用 ASP.net (VB) 动态显示数字:
1.5 => 1.5
2.0 => 2
1.25 => 1.25
您可以使用以下方法修剪零TrimEnd:
TrimEnd
string formatted = "2.0".TrimEnd(new char[] { '0', '.' });