MCPcopy Index your code
hub / github.com/endbasic/endbasic / parse_boolean

Function parse_boolean

std/src/strings.rs:39–48  ·  view source on GitHub ↗

Parses a string `s` as a boolean.

(s: &str)

Source from the content-addressed store, hash-verified

37
38/// Parses a string `s` as a boolean.
39pub fn parse_boolean(s: &str) -> Result<bool, String> {
40 let raw = s.to_uppercase();
41 if raw == "TRUE" || raw == "YES" || raw == "Y" {
42 Ok(true)
43 } else if raw == "FALSE" || raw == "NO" || raw == "N" {
44 Ok(false)
45 } else {
46 Err(format!("Invalid boolean literal {}", s))
47 }
48}
49
50/// Formats a double `d` for display.
51pub fn format_double(d: f64) -> String {

Callers 3

read_boolMethod · 0.85
continue_if_modifiedFunction · 0.85
async_execMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected