VBScript conditional short-circuiting workaround

后端 未结 9 2103
心在旅途
心在旅途 2021-02-19 05:15

I have a large classic ASP app that I have to maintain, and I repeatedly find myself thwarted by the lack of short-circuit evaluation capability. E.g., VBScript won\'t let you

9条回答
  •  爱一瞬间的悲伤
    2021-02-19 05:29

    Yeah it's not the best solution but what we use is something like this

    function ReplaceNull(s)
        if IsNull(s) or s = "" then
            ReplaceNull = " "
        else
            ReplaceNull = s
        end if
    end function
    

提交回复
热议问题