VBScript 형식화폐 함수
❮ 완전한 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
선행 0이 있거나 없는 분수 값:
<%
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 참조