📄 formatnumber.aspx
字号:
<%@ Page Language="C#" %>
<script language="C#" runat=server>
void Page_Load(Object sender , EventArgs e)
{
int intNum;
Decimal decNum;
intNum = 32001;
decNum = 32001.9099m;
// Decimal Format;
Response.Write( intNum.ToString( "d" ) + "<BR>" );
// => Displays 32001
// Exponential Format
Response.Write( intNum.ToString( "e" )+ "<BR>" );
// => Displays 3.200100e+004
Response.Write( decNum.ToString( "e" )+ "<BR>" );
// => Displays 3.200191e+004
// Fixed-Point Format
Response.Write( intNum.ToString( "f" ) + "<BR>");
// => Displays 32001.00
Response.Write( decNum.ToString( "f" ) + "<BR>");
// => Displays 32001.91
// General Format
Response.Write( intNum.ToString( "g" )+ "<BR>" );
// => Displays 32001
Response.Write( decNum.ToString( "g" )+ "<BR>" );
// => Displays 32001.9099
// Number Format
Response.Write( intNum.ToString( "n" )+ "<BR>" );
// => Displays 32,001.00
Response.Write( decNum.ToString( "n" )+ "<BR>" );
// => Displays 32,001.91
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -