Function jay_lib::fns::fn_str::get_mid_str
source · pub fn get_mid_str<S: AsRef<str>>(
start: S,
end: S,
s: S
) -> Result<String, Box<dyn Error>>
Expand description
Command get middle subject str. Example:
use jay_lib::fns::fn_str;
let s=r#"<DT><A HREF="http://web.stanford.edu/class/cs97si/" ADD_DATE="1606284605" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jV1SPWxTZxQ9937PPP/FP1JenxNDUAsqIk5FHFoqtYmCKiwVwsJQKhZABYaMLVGHdmg21ECrMiChdEHqUomxRLAUWxAgmVCKZBW1yBirpHET2+EljoP9fbcDcUpzlruce3XOuYewBb+cO/ed8bzP19bWjGjNAEBKmUAgwCoS+eHo5OQXr/PVxqTxgwetL48c+bZRKp1/ks2apcePOeS69NLzqHT3LtWKRROORj84lcl0vB0K3c49fSoAwOMAA5BUZ2fGVCpjf2Szmv1+EoDSZ8/KvtOnxRhDKhCgJ7mcRqVyPuW6GQAyDrDVCxAAQOuAt7Ji2LIgzSbZ4bA4fX0krZYo2zattTVtjDHe4mJLxeN+APgGgJUHBACMiFHMJCIAs+weGeFAPC52JEL7Tpyg53fusGKGk0jgH8/bBgDXAbK2higAiJki3d3ij8UgWktyaCgvfv+0su0CKxWsTE39BgCfAOZ/B4RIoLUEHQe7Dh8my7ZhWi2EXDcq9Xr/S89b+vjata/bfAKENzNQStk+HxutTXN1FbOXL9NquUyNWo3mZ2a2z8/MvN8qlb6aGh39+aLrhrCxx8cBAwCN9fUZ5ThzPamUr1YscueePRJ0HPiCQdSrVVkqFvXv9+419eLipz2Dgx+1v8Bt26du3PjrWa02GBsY+LXv2LGVaE+PUT6f+GMxvHnoEDqSSSZmrnueIWYLAHoB4rb9i677RuzFi/eWy+UJ8vl+iu3cycRMYoxUCwVqNRqv8iUiMUYAIA9Iu0joSqc/TOzde7u1vHwzceDAZ9sHB1EtFEDMlD5zBh1dXdDN5obo/7BZJDscpoVHj3RpepoiyaQ9eeWKvHPypCTSaSrPzcnukRGaf/jQaK1h0SvlvQBtFkmI6hHXVduCQf3nrVumVq3yu+GwPH/wQG5euEDJHTuMsiyEo1FuMtfbFlRuI0SkUoWBzk67Ix4fqhQKJtnfT5lLlyjgODSfzcp6pSJvDQ8rO5mcaHjej9fzeeQAoa1NnBodnVhfWBhLDg/r7v37CQCe3b8vf8/OKttxvj969erY6/x/AcVGWaUgUfh8AAAAAElFTkSuQmCC">CS 97SI: Introduction to Programming Contests</A>"#;
if let Ok(get)=fn_str::get_mid_str("HREF=\"","\"",s){
assert_eq!(r#"http://web.stanford.edu/class/cs97si/"#.to_string(),get);
}
if let Ok(get)=fn_str::get_mid_str("\">","</A>",s){
assert_eq!(r#"CS 97SI: Introduction to Programming Contests"#.to_string(),get);
}