VBScript FormatPara Birimi İşlevi
❮ Komple VBScript Referansı
FormatCurrency işlevi, bilgisayarın kontrol panelinde tanımlanan para birimi simgesini kullanarak para birimi değeri olarak biçimlendirilmiş bir ifade döndürür.
Sözdizimi
FormatCurrency(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(FormatCurrency(20000))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
$20,000.00
Örnek 2
Ondalık sayıların ayarlanması:
<%
response.write(FormatCurrency(20000,2) & "<br />")
response.write(FormatCurrency(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(FormatCurrency(.20,,0) & "<br />")
response.write(FormatCurrency(.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(FormatCurrency(-50,,,0) & "<br />")
response.write(FormatCurrency(-50,,,-1))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
-$50.00
($50.00)
Örnek 5
Bir milyon doları gruplandırma - ya da değil:
<%
response.write(FormatCurrency(1000000,,,,0) & "<br />")
response.write(FormatCurrency(1000000,,,,-1))
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
$1000000.00
$1,000,000.00
❮ Komple VBScript Referansı