VBScript FormatNumber 함수
❮ 완전한 VBScript 참조
FormatNumber 함수는 숫자 형식의 표현식을 반환합니다.
통사론
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:
|
예
실시예 1
<%
response.write(FormatNumber(20000))
%>
위 코드의 출력은 다음과 같습니다.
20,000.00
실시예 2
소수점 이하 자릿수 설정:
<%
response.write(FormatNumber(20000,2) & "<br />")
response.write(FormatNumber(20000,5))
%>
위 코드의 출력은 다음과 같습니다.
20,000.00
20,000.00000
실시예 3
선행 0이 있거나 없는 분수 값:
<%
response.write(FormatNumber(.20,,0) & "<br />")
response.write(FormatNumber(.20,,-1))
%>
위 코드의 출력은 다음과 같습니다.
.20
0.20
실시예 4
괄호 안의 음수 값:
<%
response.write(FormatNumber(-50,,,0) & "<br />")
response.write(FormatNumber(-50,,,-1))
%>
위 코드의 출력은 다음과 같습니다.
-50.00
(50.00)
실시예 5
그룹화 번호 - 여부:
<%
response.write(FormatNumber(1000000,,,,0) & "<br />")
response.write(FormatNumber(1000000,,,,-1))
%>
위 코드의 출력은 다음과 같습니다.
1000000.00
1,000,000.00
❮ 완전한 VBScript 참조