眾所周知:asp(VBS)是不區分大小寫的,但是你要理解這句話的意思,請看下面實例
Test.asp
<%
Dim aName
If Request.QueryString("name") <> "" Then
aName = Trim(Request.QueryString("name"))
Select Case aName
Case "new"
Response.Write "New"
Response.End
Case "top"
Response.Write "Top"
Response.End
Case Else
Response.Write "Other"
Response.End
End Select
Else
Response.Write "No Value"
Response.End
End If
%>
如果你執行http://localhost/test.asp?name=new,它會輸出:New
而如果執行http://localhost/test.asp?name=New,它卻輸出:Other所以確保不出現意想不到的錯誤,在select Case中先將條件轉成大/小寫,這樣
<%
Dim aName
If Request.QueryString("name") <> "" Then
aName = LCase(Request.QueryString("name"))
Select Case aName
Case "new"
Response.Write "New"
Response.End
Case "top"
Response.Write "Top"
Response.End
Case Else
Response.Write "Other"
Response.End
End Select
Else
Response.Write "No Value"
Response.End
End If
%>
總之,要理解VB不區分大小寫的意思是什麼...
對象名、屬性名、變量名等本身構成的語法不區分大小寫
然而屬性值、變量值區分大小寫,也就是說:"A"="a"為false