如何将长值转换为KB字符串格式 [英] How do I convert from long value to KB string format

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

问题描述

如何像快照图片一样以KB表示长值?

How do I represent a long value in KB like the snapshot picture?

推荐答案

这可能是您要查找的内容:

This is probably what you're looking for:

long memory = 210957130;
Console.WriteLine("{0:N0} K", memory / 1024);
Console.WriteLine(string.Format(new CultureInfo("en-US"), "{0:N0} K", memory / 1024));

如果您想使用当前区域设置中的千位分隔符,请使用第一个选项.如果您特别想使用逗号,请使用第二个选项.

If you'd like to use the thousand separator from your current regional settings, use the first option. If you specifically want to use a comma, use the second option.

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

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