数字格式.. [英] Number Format..

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

问题描述




我正在尝试将数字格式化为以下数字,10到10。使用,

Printline(1,格式(10,&###。###))自然这没有达到

所需的结果,我知道如果我这样做,Printline(1,格式(10,###。0 ##))I

得到这个10.0但我不需要尾随0。关于如何从这个10获得

的任何想法到这个10。


谢谢,


加里

Hi,

I am trying to format a number to the following, "10" to "10." using,
Printline(1, format(10, "###.###)) naturally this does not achieve the
desired result, I know if I do this, Printline(1, format(10, "###.0##)) I
get this "10.0" but I do not need the trailing "0" any ideas on how to get
from this "10" to this "10."?

Thanks,

Gary

推荐答案

你只想在你的号码末尾添加句号

console.writeline(10&"。")

? ???

你想要用尾随零格式化它吗?

Console.WriteLine(FormatNumber(10,2))

" Gary" < SP ** @ spam.com>在消息中写道

新闻:OD ************** @ tk2msftngp13.phx.gbl ...
You only want to add a period to the end of your number
console.writeline(10 & ".")
????
You want it formatted with trailing zeros?
Console.WriteLine(FormatNumber(10, 2))
"Gary" <sp**@spam.com> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...

我正在尝试将数字格式化为以下数字,10到10。使用,
Printline(1,格式(10,&###。###))自然这没有达到预期的结果,我知道如果我这样做,Printline(1,格式) (10,###。0 ##)我得到这个10.0。但我不需要尾随0。关于如何从这个10获得
的任何想法到这个10。

谢谢,

Gary
Hi,

I am trying to format a number to the following, "10" to "10." using,
Printline(1, format(10, "###.###)) naturally this does not achieve the
desired result, I know if I do this, Printline(1, format(10, "###.0##)) I
get this "10.0" but I do not need the trailing "0" any ideas on how to get
from this "10" to this "10."?

Thanks,

Gary



*杰瑞德 < VB *********** @ email.com> scripsit:
* "Jared" <VB***********@email.com> scripsit:
你只想在你的号码末尾添加句号
console.writeline(10&"。")
You only want to add a period to the end of your number
console.writeline(10 & ".")




但是,如果数字是可变的,可以是10,10.2,......怎么样?


-

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>



But what if the number is variable and can be 10, 10.2, ...?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


什么是变量?


似乎Herfried并不是非常喜欢我,他对我的

帖子非常挑剔。

我仍​​会赞美任何来自你的帮助,谢谢!


" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道

news:ed ************** @ TK2MSFTNGP10.phx.gbl ...
What is a variable?

Seems Herfried doesn''t like me very much, he''s been pretty picky about my
postings.
I would still appriciate any help from you, Thanks!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
*" Jared" < VB *********** @ email.com> scripsit:
* "Jared" <VB***********@email.com> scripsit:
你只想在你的号码末尾添加句号
console.writeline(10&"。")
You only want to add a period to the end of your number
console.writeline(10 & ".")



- Herfried K. Wagner [MVP]
< http:/ /www.mvps.org/dotnet>



But what if the number is variable and can be 10, 10.2, ...?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>



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

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