本文介绍了double.NaN.ToString()以“¤¤¤”结尾不是预期的“NaN”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

double.NaN.ToString()以"¤¤¤"结尾不是预期的"NaN"为什么会这样?

double.NaN.ToString() ending up "¤¤¤" not as Expected "NaN" why is this?

在执行 

  System.Globalization.NumberFormatInfo numberFormatInfo =

    (System.Globalization.NumberFormatInfo)System.Globalization.NumberFormatInfo.CurrentInfo.Clone();

 System.Globalization.NumberFormatInfo numberFormatInfo =
    (System.Globalization.NumberFormatInfo)System.Globalization.NumberFormatInfo.CurrentInfo.Clone();

numberFormatInfo.NaNSymbol is "¤¤¤"

numberFormatInfo.NaNSymbol is "¤¤¤"

这是为什么?

// m

---系统-------------------------------- ---------------------------

--- System -----------------------------------------------------------

Windows 10(1709 16299.192),zh -Gb版本,国家或地区"瑞典",语言" Svensaka"

Windows 10 (1709 16299.192), en-Gb version, Country or region "Sweden", Language "Svensaka"

VisualStudio.15.Release / 15.5.5 + 27130.2026

Microsoft .NET框架

版本4.7.02556

VisualStudio.15.Release/15.5.5+27130.2026
Microsoft .NET Framework
Version 4.7.02556

---------------------- ----------------------------------------

--------------------------------------------------------------

moviestar

moviestar

推荐答案

var result1 = Double.NaN.ToString();

var numberFormatInfo = System.Globalization.NumberFormatInfo.CurrentInfo.Clone() as System.Globalization.NumberFormatInfo;

var result2 = numberFormatInfo.NaNSymbol;




result1和result2应该相同。


result1 and result2 should be the same.


这篇关于double.NaN.ToString()以“¤¤¤”结尾不是预期的“NaN”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 08:18