【发布时间】:2021-11-09 23:07:13
【问题描述】:
使用FluentAssertions,有什么好的方法可以确认小数点后的字符数吗?我一直在寻找最好的方法来做到这一点,但找不到太多。
【问题讨论】:
-
没有任何内置功能,但您需要做的第一件事似乎是count the number of decimal digits in the number。
-
var digits = numberString.Length - numberString.LastIndexOf(CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator) - 1;
标签: c# .net fluent-assertions