VBScript Round Function
❮ การอ้างอิง VBScript ที่สมบูรณ์
ฟังก์ชัน Round ปัดเศษตัวเลข
ไวยากรณ์
Round(expression[,numdecimalplaces])
Parameter | Description |
---|---|
expression | Required. The numeric expression to be rounded |
numdecimalplaces | Optional. Specifies how many places to the right of the decimal are included in the rounding. Default is 0 |
ตัวอย่าง
ตัวอย่าง 1
<%
response.write(Round(24.13278) & "<br />")
response.write(Round(24.75122))
%>
ผลลัพธ์ของโค้ดด้านบนจะเป็น:
24
25
ตัวอย่าง 2
วิธีปัดเศษตัวเลขโดยเก็บทศนิยม 2 ตำแหน่ง:
<%
response.write(Round(24.13278,2))
%>
ผลลัพธ์ของโค้ดด้านบนจะเป็น:
24.13
❮ การอ้างอิง VBScript ที่สมบูรณ์