显示格式字符串,诠释为百分比 [英] Display format string, int to percent

查看:329
本文介绍了显示格式字符串,诠释为百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些整数值(1到100),我想使用他们在一个进度条,具有DisplayFormatString财产。

我也想在输出字符串中的百分比符号%。

现在的问题是,通过使用符号,它会自动用100乘以我的价值,它表明类似3300%,我的价值时,我想他们的33%。我如何可以克服这一点?

  DisplayFormatString =0%
 

解决方案

尝试使用 0'%' DisplayFormatString ,(百分比单引号),这应该有助于实现追加百分号到你的电话号码。所以,你得到 33%

还有一件事你可以尝试,也许是 0 \\%(不知道是否会工作或没有),但应制定出同一个 33%,你的愿望。

I have some integer values (between 1 and 100) and I want to use them in a progress bar, that has a DisplayFormatString property.

I also want to have the percent symbol '%' in the output string.

The problem is that by using the symbol, it automatically multiplies my value with 100, and it shows my values like 3300% when I wanted them 33%. How may I overcome this?

DisplayFormatString="0%"

解决方案

Try using 0'%' as the DisplayFormatString, (percentage in single quotes) this should help in achieving to append the percentage sign to your number. So you get 33%.

One more thing you could try maybe is 0\\% (not sure if it would work or not) but should work out to the same 33% as you desire.

这篇关于显示格式字符串,诠释为百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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