Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The STRINGTOBOOLEAN
function converts a string expression to a boolean.
An Azure Cosmos DB for NoSQL system function that returns a string expression converted to a boolean.
Syntax
STRINGTOBOOLEAN(<string_expr>)
Arguments
Description | |
---|---|
string_expr |
A string expression. |
Return types
Returns a boolean value.
Examples
This section contains examples of how to use this query language construct.
Convert string to boolean
In this example, the STRINGTOBOOLEAN
function is used to parse various string values into booleans.
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
}
]
Remarks
- This function doesn't utilize the index.