最新消息:觉得本站不错的话 记得收藏哦 博客内某些功能仅供测试 讨论群:135931704 快养不起小站了 各位有闲钱就打赏下把 My Email weicots#gmail.com Please replace # with @

表达式中的运算符EQ NE GT GE LT LE…..

LINX-SQL ajiang-tuzi 10420浏览

EQ NE GT GE LT LE

GT=Great Than >
EQ=Equal =
GE=Great and Equal >=
NE=Not Equal <>

//等运算符,如果运算符两边相同则返回真,否则返回假;

NE(Not Equal to)
//不等运算符,如果运算符两边不等则返回真,否则返回假;

GE(Greater than or equal to)
//大于等于运算符,如果运算符两边左边大于等于右边则返回真,否则返回假;

GT(Greater than)
//大于运算符,如果运算符两边左边大于右边则返回真,否则返回假;

LE(Less than or equal to)
//小于等于运算符,如果运算符两边左边小于等于右边则返回真,否则返回假;

LT(Less than)
//小于运算符,如果运算符两边左边大于右边则返回真,否则返回假;

类别 运算符

算术运算符 + 、 - 、 * 、 / (或 div )和 % (或 mod ) 
关系运算符 == (或 eq )、 != (或 ne )、 < (或 lt )、 > (或 gt )、 <= (或 le )和 >= (或 ge ) 
逻辑运算符 && (或 and )、 || (或 or )和 ! (或 not ) 
验证运算符 empty

参考及引用

7.2. String Comparison Operators

In order to compare for string equality, or if one string is alphabetically bigger than another, you can use the six string comparison operators. Here are the string operators together with the numerical operators they correspond too:

String Operator Numerical Operator
eq ==
ne !=
gt >
lt <
ge >=
le <=

Notice that the string operators are built from the initials of their abbreviated names. (E.g: eq = equal, gt = greater than). Perl’s string comparison is case-sensitive. If you want a case insensitive string comparison, use thelc function to convert the strings to lowercase beforehand.

Example:

print "Please enter your private name:\n";
$name = <>;
chomp($name);
if (lc($name) eq "rachel")
{
    print "Your name is Rachel!\n";
}
else
{
    print "Your name is not Rachel!\n";
} 

转载请注明:(●--●) Hello.My Weicot » 表达式中的运算符EQ NE GT GE LT LE…..

蜀ICP备15020253号-1