【问题标题】:Uipath two decimal placesuipath 两位小数
【发布时间】:2018-05-30 17:54:37
【问题描述】:

我需要将我的双精度值例如“12.4”格式化为“12.40”,将“1”格式化为“1.00”,我在互联网上搜索了整整一个小时的函数但找不到,或者有还有其他方法可以解决吗?所有内容都必须在 .xls 文件中查看。

【问题讨论】:

  • 你还没有看到 ToString 和 standard numeric format strings?
  • @Steve,我使用过 math.Round(Double.Parse(taxDataRowItem),2),但最后打印出来的不是零
  • 当您说“必须在 .xls 文件中查看所有内容”时,您的意思是所有小数位在某些 Excel 文件中仍应可见,还是您需要在 Excel 中显示两位小数?对于后者,您需要将 Excel 中的单元格格式设置为“0.00”。

标签: vb.net uipath


【解决方案1】:

VB.NET 有几个函数可以将小数格式化为字符串。

Dim integerNumber As Integer
integerNumber = 17843
Console.WriteLine(integerNumber.ToString("F", CultureInfo.InvariantCulture))
' Displays 17843.00

https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-04
    • 2020-07-10
    • 2021-12-13
    • 1970-01-01
    • 1970-01-01
    • 2011-08-29
    相关资源
    最近更新 更多