وظيفة VBScript FormatCurrency
استكمال مرجع VBScript
تُرجع الدالة FormatCurrency تعبيرًا منسقًا كقيمة عملة باستخدام رمز العملة المحدد في لوحة تحكم الكمبيوتر.
بناء الجملة
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:
|
أمثلة
مثال 1
<%
response.write(FormatCurrency(20000))
%>
ناتج الكود أعلاه سيكون:
$20,000.00
مثال 2
تحديد عدد الكسور العشرية:
<%
response.write(FormatCurrency(20000,2) & "<br />")
response.write(FormatCurrency(20000,5))
%>
ناتج الكود أعلاه سيكون:
$20,000.00
$20,000.00000
مثال 3
القيم الكسرية بصفر بادئ أو بدون:
<%
response.write(FormatCurrency(.20,,0) & "<br />")
response.write(FormatCurrency(.20,,-1))
%>
ناتج الكود أعلاه سيكون:
$.20
$0.20
مثال 4
القيم السالبة داخل أقواس أم لا:
<%
response.write(FormatCurrency(-50,,,0) & "<br />")
response.write(FormatCurrency(-50,,,-1))
%>
ناتج الكود أعلاه سيكون:
-$50.00
($50.00)
مثال 5
تجميع مليون دولار - أم لا:
<%
response.write(FormatCurrency(1000000,,,,0) & "<br />")
response.write(FormatCurrency(1000000,,,,-1))
%>
ناتج الكود أعلاه سيكون:
$1000000.00
$1,000,000.00
استكمال مرجع VBScript