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

Function parse_integer

std/src/strings.rs:69–74  ·  view source on GitHub ↗

Parses a string `s` as an integer.

(s: &str)

Source from the content-addressed store, hash-verified

67
68/// Parses a string `s` as an integer.
69pub fn parse_integer(s: &str) -> Result<i32, String> {
70 match s.parse::<i32>() {
71 Ok(d) => Ok(d),
72 Err(_) => Err(format!("Invalid integer literal {}", s)),
73 }
74}
75
76/// Returns the byte offset of the given character position within `s`.
77fn char_index_to_byte_index(s: &str, char_index: usize) -> usize {

Callers 1

async_execMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected