如何从文本或数字中删除格式 [英] how to remove format from text or number

查看:73
本文介绍了如何从文本或数字中删除格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家..我有关于如何删除数字输入格式的问题..

我的问题是如何删除货币格式,例如1,000.00我只是想删除逗号和句号就这样它会像这样的1000或我想我只需要改变它的格式..对不起我的坏英语家伙..

hi guys.. im having problem on how to remove format on a number input..
my problem is how to remove the currency format like for example "1,000.00" i just want to remove the commas and period on it so that it will something like this "1000" or i guess i just need to change the format of it.. sorry for my bad english guys..

推荐答案

请参阅我对该问题的评论。您需要付出一些努力来指定分隔符的格式,但默认情况下您已经得到了所需的内容。简单 int.ToString()将返回您想要的内容或 string.Format({0} ...,myNumericValue) ...



如需更高级的格式,请参阅:

http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/0c899ak8.aspx [ ^ ]。



-SA
Please see my comment to the question. You need to pay some effort to specify the format with separators, but by default you already got what you needed. Simple int.ToString() will return what you want or string.Format("{0} ...", myNumericValue)...

For more advanced formatting, see also:
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx[^],
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx[^].

—SA


您可以尝试使用单或双类型的解析方法..

如果你的号码是..... 00.00格式然后只需这个

You could try using the parse method of the "single" or "double" type..
If your number is .....00.00 format then simply this
double.Parse("1,000,000.00")



会给你 1000000


这篇关于如何从文本或数字中删除格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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