ฟังก์ชัน TypeName ของ VBScript

การกำหนดและการใช้งาน

TypeName ฟังก์ชันสามารถกำหนดชนิดตัวแปรย่อยของตัวแปรได้

ค่าที่ TypeName ฟังก์ชันสามารถกลับค่าได้

ค่า รายละเอียด
Byte ค่า byte
Integer ค่า integer
Long ค่า long integer
Single ค่า single precision floating point
Double ค่า double precision floating point
Currency ค่าเงิน
Decimal ค่าเดcimal
Date ค่าวันและเวลา
String ค่าข้อความ
Boolean ค่า Boolean; True หรือ False
Empty ยังไม่ได้เริ่มต้น
Null ไม่มีข้อมูลที่มีประโยชน์
<object type> ชื่อชนิดตัวแปรที่เป็นจริง
Object ตัวแปรทั่วไป
Unknown ชนิดตัวแปรที่ไม่ทราบ
Nothing ตัวแปรตัวแปรที่ยังไม่ได้เรียกใช้ตัวอุปกรณ์ตัวอย่าง
Error Error

การใช้งาน

TypeName(varname)
ประกาศ รายละเอียด
varname จำเป็นต่อตัวแปร ชื่อตัวแปร

ตัวอย่าง

dim x
x="Hello World!"
document.write(TypeName(x))
x=4
document.write(TypeName(x))
x=4.675
document.write(TypeName(x))
x=Null
document.write(TypeName(x))
x=Empty
document.write(TypeName(x))
x=True
document.write(TypeName(x))

ออกทาง

String
Integer
Double
Null
Empty
Boolean