formatnumber.aspx

来自「asp.net技术内幕的书配源码」· ASPX 代码 · 共 53 行

ASPX
53 行
字号
<%
Dim intNum As Integer
Dim decNum As Decimal

intNum = 32001
decNum = 32001.9099

' Decimal Format
Response.Write( intNum.ToString( "d" ) )
' => Displays 32001


' Exponential Format
Response.Write( intNum.ToString( "e" ) )
' => Displays 3.200100e+004

Response.Write( decNum.ToString( "e" ) )
' => Displays 3.200191e+004



' Fixed-Point Format
Response.Write( intNum.ToString( "f" ) )
' => Displays 32001.00

Response.Write( decNum.ToString( "f" ) )
' => Displays 32001.91



' General Format
Response.Write( intNum.ToString( "g" ) )
' => Displays 32001

Response.Write( decNum.ToString( "g" ) )
' => Displays 32001.9099



' Number Format
Response.Write( intNum.ToString( "n" ) )
' => Displays 32,001.00

Response.Write( decNum.ToString( "n" ) )
' => Displays 32,001.91



' HexaDecimal Format
Response.Write( intNum.ToString( "x" ) )
' => Displays 7d01
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?