如何在C#格式化1700 1'700至1000000至1'000'000? [英] how to format 1700 to 1'700 and 1000000 to 1'000'000 in c#?

查看:114
本文介绍了如何在C#格式化1700 1'700至1000000至1'000'000?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢格式化所有号码,如在数学。有一个预定义的功能或者是只是可能的子串并替换

I like to format all numbers like in math. is there a predefined function or is that just possible with substring and replace?

编辑:我的文化是DE-CH

edit: my culture is de-ch

最好的问候

推荐答案

试试这个

int input = Convert.ToInt32("1700");
string result = String.Format("{0:##,##}", input);



或者这

Or this

Console.WriteLine(1700.ToString("##,##", new NumberFormatInfo() { NumberGroupSeparator = "'" })); 

这篇关于如何在C#格式化1700 1'700至1000000至1'000'000?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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