pub const fn get_from(string: &str, from: usize) -> Option<&str>
Expand description
A const equivalent of string.get(from..)
.
§Example
use konst::string;
const STR: &str = "foo bar baz";
const SUB0: Option<&str> = string::get_from(STR, 0);
assert_eq!(SUB0, Some(STR));
const SUB1: Option<&str> = string::get_from(STR, 4);
assert_eq!(SUB1, Some("bar baz"));
const SUB2: Option<&str> = string::get_from(STR, 8);
assert_eq!(SUB2, Some("baz"));
const SUB3: Option<&str> = string::get_from(STR, 100);
assert_eq!(SUB3, None);