什么是“<>”asp 运算符?

What is the '<>' asp operator?

简单的问题。我尝试通过谷歌搜索小于和大于符号进行搜索,但结果并不 return。

我的猜测是 <> 基本上等同于 not equals。因此,如果 x 为 null 或空字符串,则以下表达式为假,否则为真?

if x <> ""

So, the below expression would be false if x is null or an empty string, and true otherwise?

不完全是。验证值的函数很少:

IsNull(expression)

IsNull returns True if expression is Null, that is, it contains no valid data; otherwise, IsNull returns False. If expression consists of more than one variable, Null in any constituent variable causes True to be returned for the entire expression.

The Null value indicates that the variable contains no valid data. Null is not the same as Empty, which indicates that a variable has not yet been initialized. It is also not the same as a zero-length string (""), which is sometimes referred to as a null string.

IsEmpty(expression)

The expression argument can be any expression. However, because IsEmpty is used to determine if individual variables are initialized, the expression argument is most often a single variable name.

IsEmpty returns True if the variable is uninitialized, or is explicitly set to Empty; otherwise, it returns False. False is always returned if expression contains more than one variable.

其他不错的功能

VarType(varname)

Returns a value indicating the subtype of a variable.

使用来自 http://www.microsoft.com/en-us/download/details.aspx?id=2764

的 Windows Script 5.6 文档

如果列出的实体中包含一个值,这也 return 为真。这通常用于查找可能已提供或未提供的查询字符串或表单元素:

If Request("someFieldName") <> "" Then
  ' Field was provided and has a value, so use the field value
Else
  ' Field was either empty or not provided, in which case use something else
End If

希望对您有所帮助。