What does char 160 mean in my source code?

前端 未结 8 1217
温柔的废话
温柔的废话 2021-02-05 00:01

I am formatting numbers to string using the following format string \"# #.##\", at some point I need to turn back these number strings like (1 234 567) into something like 1234

8条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-05 00:20

    Solution with extended methods:

    public static class ExtendedMethods
    {
        public static string NbspToSpaces(this string text)
        {
            return text.Replace(Convert.ToChar(160), ' ');
        }
    }
    

    And it can be used with this code:

    value = value.NbspToSpaces();
    

提交回复
热议问题