Hàm VBScript StrComp
❮ Toàn bộ tài liệu tham khảo VBScript
Hàm StrComp so sánh hai chuỗi và trả về một giá trị đại diện cho kết quả của phép so sánh.
Hàm StrComp có thể trả về một trong các giá trị sau:
- -1 (nếu string1 <string2)
- 0 (nếu string1 = string2)
- 1 (nếu string1> string2)
- Null (nếu string1 hoặc string2 là Null)
Cú pháp
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:
|
ví dụ 1
response.write(StrComp("VBScript","VBScript"))
Output:
0
Ví dụ 2
response.write(StrComp("VBScript","vbscript"))
Output:
-1
Ví dụ 3
response.write(StrComp("VBScript","vbscript",1))
Output:
0
❮ Toàn bộ tài liệu tham khảo VBScript