适用范围: NoSQL
将字符串表达式转换为布尔值。
语法
StringToBoolean(<string_expr>)  
参数
| 说明 | |
|---|---|
string_expr | 
一个字符串表达式。 | 
返回类型
返回一个布尔值。
示例
以下示例演示此函数如何处理各种数据类型。
SELECT VALUE {
    parseBooleanString: StringToBoolean("true"),
    parseWithPrefix: StringToBoolean("true  "),
    parseWithSuffix: StringToBoolean("  false"),
    parseWithWhitespace: StringToBoolean("  false  "),
    parseBoolean: StringToBoolean(true),
    parseUndefined: StringToBoolean(undefined),
    parseNull: StringToBoolean(null)
}
[
  {
    "parseBooleanString": true,
    "parseWithPrefix": true,
    "parseWithSuffix": false,
    "parseWithWhitespace": false
  }
]
注解
- 此函数不使用索引。
 - 如果表达式无法转换,则函数将返回 
undefined。 
注意
有关 JSON 格式的详细信息,请参阅 https://json.org。