VBScript FormatSayı İşlevi
❮ Komple VBScript Referansı
FormatNumber işlevi, sayı olarak biçimlendirilmiş bir ifade döndürür.
Sözdizimi
FormatNumber(Expression[,NumDigAfterDec[,
IncLeadingDig[,UseParForNegNum[,GroupDig]]]])
Parameter | Description |
---|---|
expression | Required. The expression to be formatted |
NumDigAfterDec | Optional. Indicates how many places to the right of the decimal are displayed. Default is -1 (the computer's regional settings are used) |
IncLeadingDig | Optional. Indicates whether or not a leading zero is
displayed for fractional values:
|
UseParForNegNum | Optional. Indicates whether or not to place negative
values within parentheses:
|
GroupDig | Optional. Indicates whether or not numbers are grouped
using the group delimiter specified in the computer's regional settings:
|
Örnekler
örnek 1
<%
response.write(FormatNumber(20000))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
20,000.00
Örnek 2
Ondalık sayıların ayarlanması:
<%
response.write(FormatNumber(20000,2) & "<br />")
response.write(FormatNumber(20000,5))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
20,000.00
20,000.00000
Örnek 3
Başında sıfır olan veya olmayan kesirli değerler:
<%
response.write(FormatNumber(.20,,0) & "<br />")
response.write(FormatNumber(.20,,-1))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
.20
0.20
Örnek 4
Parantez içindeki negatif değerler veya değil:
<%
response.write(FormatNumber(-50,,,0) & "<br />")
response.write(FormatNumber(-50,,,-1))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
-50.00
(50.00)
Örnek 5
Numaraları gruplandırma - veya değil:
<%
response.write(FormatNumber(1000000,,,,0) & "<br />")
response.write(FormatNumber(1000000,,,,-1))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
1000000.00
1,000,000.00
❮ Komple VBScript Referansı