rusty_ci/helper/string.rs
1/// Unquotes `s`.
2pub fn unquote(s: &str) -> String {
3 if s.chars().count() < 2 {
4 return String::from(s);
5 }
6
7 let quote = s.chars().next().unwrap();
8
9 if quote != '"' && quote != '\'' && quote != '`' {
10 return String::from(s);
11 }
12
13 if s.chars().last().unwrap() != quote {
14 return String::from(s);
15 }
16
17 String::from(&s[1..s.len() - 1])
18}