将货币转换为字符串 [英] Convert Currency to String

查看:72
本文介绍了将货币转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.

我需要将货币"转换为普通字符串.

价值$ 2 500.00需要转换为2500 OR
$ 2 499.99至2499.99

我尝试了

Hi there.

I need to convert from Currency to normal string.

Value $2 500.00 needs to be converted to 2500 OR
$2 499.99 to 2499.99

I tried

string test = Convert.ToString(Total.Text.Replace("$", "").Replace(".", ""));

,但随后得到的值是250000或249999,这使我的计算达到了数百万.

有什么帮助吗?
Thanx

but then i get the value 250000 or 249999 which brings my calculation into the millions.

Any help please?
Thanx

推荐答案

2 500.00需要转换为2500 OR
2 500.00 needs to be converted to 2500 OR


2 499.99到2499.99

我尝试了
2 499.99 to 2499.99

I tried
string test = Convert.ToString(Total.Text.Replace("


", "").Replace(".", ""));
", "").Replace(".", ""));

,但随后得到的值是250000或249999,这使我的计算达到了数百万.

有什么帮助吗?
谢谢

but then i get the value 250000 or 249999 which brings my calculation into the millions.

Any help please?
Thanx


这篇关于将货币转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆