Skip to main content

to_bool

Function to_bool 

Source
pub fn to_bool(value: &str) -> Option<bool>
Expand description

Convert a boolean-like string to an actual boolean.

ยงExample

use polyglot_sql::helper::to_bool;

assert_eq!(to_bool("true"), Some(true));
assert_eq!(to_bool("1"), Some(true));
assert_eq!(to_bool("false"), Some(false));
assert_eq!(to_bool("0"), Some(false));
assert_eq!(to_bool("maybe"), None);