On this page本页内容
$strcasecmp
¶Performs case-insensitive comparison of two strings. 对两个字符串执行不区分大小写的比较。Returns退换商品
1
0
。-1
。$strcasecmp
has the following syntax:语法如下所示:
The arguments can be any valid expression as long as they resolve to strings. 参数可以是任何有效的表达式,只要它们解析为字符串。For more information on expressions, see Expressions.有关表达式的详细信息,请参阅表达式。
$strcasecmp
only has a well-defined behavior for strings of ASCII characters.仅对ASCII字符字符串具有定义良好的行为。
For a case sensitive comparison, see 有关区分大小写的比较,请参阅$cmp
.$cmp
。
Consider a 考虑一个inventory
collection with the following documents:inventory
集合带有以下文档:
The following operation uses the 以下操作使用$strcasecmp
operator to perform case-insensitive comparison of the quarter
field value to the string "13q4"
:$strcasecmp
运算符对quarter
字段值与字符串"13q4"
进行不区分大小写的比较:
The operation returns the following results:操作返回以下结果: