zoukankan      html  css  js  c++  java
  • ASP 空字符串、IsNull、IsEmpty区别分析

    说明:set aa=server.createobject("ddd") isnull 说明指针为空,指针指到一个无效的位置,即对象不存在, isempty 说明指针指向一个有效位置,但是值为空

    1、空字符串 例: 复制代码 代码如下: a)Dim strTmp response.write(strTmp="") ' 返回true b)response.write(str="") ' 返回 true c)Dim strTmp strTmp="" response.write(strTmp="") ' 返回 true

    这几行代码说明ASP中无论是没做过声明的变量还是做个声明但没有赋值的变量ASP都认为是空字符串或叫做零长度字符串。

    2、IsEmpty() 如果变量未初始化或显式地设置为 Empty,则函数 IsEmpty 返回 True; 否则函数返回 False。如果 expression 包含一个以上的变量,总返回 False。 例: 复制代码 代码如下: a)Dim strTmp Response.Write(IsEmpty(strTmp)) ' 返回 True b)Dim strTmp strTmp = Null Response.Write(IsEmpty(strTmp)) ' 返回 Flase c)Dim strTmp strTmp = Empty Response.Write(IsEmpty(strTmp)) ' 返回 True d)Dim strTmp strTmp = "" Response.Write(IsEmpty(strTmp)) ' 返回 Flase

    3、IsNull() Null 值指出变量不包含有效数据。Null 与 Empty 不同,后者指出变量未经初始化。Null 与零长度字符串 ("") 也不同,零长度字符串往往指的是空串。 使用 IsNull 函数可以判断表达式是否包含 Null 值。 例: 复制代码 代码如下: a)Dim strTmp Response.Write(IsNull(strTmp)) ' 返回 False b)Response.Write(IsNull(strTmp)) ' 返回 False 注意这里strTmp是一个未经声明的变量 a)Dim strTmp strTmp = Null Response.Write(IsNull(strTmp)) ' 返回 True a)Dim strTmp strTmp = Empty Response.Write(IsNull(strTmp)) ' 返回 False

  • 相关阅读:
    由PhysicalFileProvider构建的物理文件系统
    Net Core WebApi单元测试
    多个项目使用NET Core
    ReactNative
    定制样式插入到ueditor
    ES6的Class
    Redis存储Session
    二叉 查找树 排序树 搜索树
    SignalR实现实时日志监控
    KNN(k-nearest neighbor的缩写)又叫最近邻算法
  • 原文地址:https://www.cnblogs.com/vera/p/2802939.html
Copyright © 2011-2022 走看看