VBScript -indeling Valuta- functie
❮Volledige VBScript-referentie
De functie FormatCurrency retourneert een uitdrukking die is opgemaakt als een valutawaarde met behulp van het valutasymbool dat is gedefinieerd in het configuratiescherm van de computer.
Syntaxis
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:
|
Voorbeelden
voorbeeld 1
<%
response.write(FormatCurrency(20000))
%>
De uitvoer van de bovenstaande code zal zijn:
$20,000.00
Voorbeeld 2
Aantal decimalen instellen:
<%
response.write(FormatCurrency(20000,2) & "<br />")
response.write(FormatCurrency(20000,5))
%>
De uitvoer van de bovenstaande code zal zijn:
$20,000.00
$20,000.00000
Voorbeeld 3
Breukwaarden met of zonder voorloopnul:
<%
response.write(FormatCurrency(.20,,0) & "<br />")
response.write(FormatCurrency(.20,,-1))
%>
De uitvoer van de bovenstaande code zal zijn:
$.20
$0.20
Voorbeeld 4
Negatieve waarden tussen haakjes of niet:
<%
response.write(FormatCurrency(-50,,,0) & "<br />")
response.write(FormatCurrency(-50,,,-1))
%>
De uitvoer van de bovenstaande code zal zijn:
-$50.00
($50.00)
Voorbeeld 5
Een miljoen dollar groeperen - of niet:
<%
response.write(FormatCurrency(1000000,,,,0) & "<br />")
response.write(FormatCurrency(1000000,,,,-1))
%>
De uitvoer van de bovenstaande code zal zijn:
$1000000.00
$1,000,000.00
❮Volledige VBScript-referentie