当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP教程:ASP是不区分大小写

ASP
ASP编程中15个非常有用的例子 (二)
ASP与JSP的比较(一)
ASP与JSP的比较(二)
ASP中五种连接数据库的方法
从ASP调用SQL中的图像
用排序串字段实现树状结构(例程:连接字串)
用排序串字段实现树状结构(例程:删除贴子)
用排序串字段实现树状结构(例程:回复表单)
用排序串字段实现树状结构(例程:显示贴子内容)
用排序串字段实现树状结构(例程:显示树)
用排序串字段实现树状结构(存储过程)
用排序串字段实现树状结构(库结构)
用排序串字段实现树状结构(原理)
remote script文档(转载自微软)(一)
remote script文档(转载自微软)(二)
remote script文档(转载自微软)(三)
remote script文档(转载自微软)(四)
remote script文档(转载自微软)(五)
remote script文档(转载自微软)(六)
remote script文档(转载自微软)(七)

ASP教程:ASP是不区分大小写


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 165 ::
收藏到网摘: n/a

众所周知: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