Decimal转换成¥:123.00格式后再转换成Decimal格式的方法

<asp:BoundField DataField="QianShouEr" HeaderText="欠收额(元)" DataFormatString="{0:C}" HtmlEncode="false">
                        <HeaderStyle BorderColor="Black" BorderWidth="1px" HorizontalAlign="Center" VerticalAlign="Middle"
                            Width="70px" />
                        <ItemStyle BorderColor="Black" BorderWidth="1px" ForeColor="Red" HorizontalAlign="Center"
                            Width="75px" />
</asp:BoundField>

页面显示为:¥23,456.00。

要求转换成Decimal/double格式进行数学运算

方法如下:

string b=¥23,456.00;

decimal   c   =   Convert.ToDecimal(b.Replace( "¥ ",   " ").trim());

this.lblYSE.Text = c.ToString("C");

页面显示为:¥23,456.00。


 

原文地址:https://www.cnblogs.com/12go/p/2139089.html