日期:2014-05-20  浏览次数:20374 次

急~货币格式化(还原)问题
有一decimal型变量,应需要把它转换成¥33.00的string类型,后应需要想把¥33.00转回33.00的形式,类似
        class   Class1
        {

                static   void   Main()
                {
                        decimal   a   =   33;
                        Console.Write(a.ToString( "C "));
                        string   b   =   a.ToString( "C ");
                        decimal   c   =   Convert.ToDecimal(b);//出错
                        Console.Write(c.ToString());
                        Console.ReadKey();
                }
        }
各位大虾帮帮忙

------解决方案--------------------
直接去掉第一个字符好了
------解决方案--------------------
同意思楼上,,直接用个函数去掉就行了
------解决方案--------------------
decimal c = Convert.ToDecimal(b.Replace( "¥ ", " "));
------解决方案--------------------
decimal a = 33;
Console.Write(a.ToString( "C "));
string b = a.ToString( "N ");
decimal c = Convert.ToDecimal(b);
Console.Write(c.ToString());
------解决方案--------------------