ฟังก์ชันVBScript StrComp
❮ การอ้างอิง VBScript ที่สมบูรณ์
ฟังก์ชัน StrComp จะเปรียบเทียบสองสตริงและส่งกลับค่าที่แสดงผลลัพธ์ของการเปรียบเทียบ
ฟังก์ชัน StrComp สามารถคืนค่าใดค่าหนึ่งต่อไปนี้:
- -1 (ถ้า string1 < string2)
- 0 (ถ้า string1 = string2)
- 1 (ถ้า string1 > string2)
- Null (ถ้า string1 หรือ string2 เป็น Null)
ไวยากรณ์
StrComp(string1,string2[,compare])
Parameter | Description |
---|---|
string1 | Required. A string expression |
string2 | Required. A string expression |
compare | Optional. Specifies the string comparison to use.
Default is 0 Can have one of the following values:
|
ตัวอย่าง 1
response.write(StrComp("VBScript","VBScript"))
Output:
0
ตัวอย่าง 2
response.write(StrComp("VBScript","vbscript"))
Output:
-1
ตัวอย่างที่ 3
response.write(StrComp("VBScript","vbscript",1))
Output:
0
❮ การอ้างอิง VBScript ที่สมบูรณ์