StringToBoolean (NoSQL query)
APPLIES TO: NoSQL
Converts a string expression to a boolean.
StringToBoolean(<string_expr>)
Description | |
---|---|
string_expr |
A string expression. |
Returns a boolean value.
The following example illustrates how this function works with various data types.
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
}
]
- This function doesn't use the index.
- If the expression can't be converted, the function returns
undefined
.
Note
For more information on the JSON format, see https://json.org.