j_cli/util/mod.rs
1pub mod fuzzy;
2pub mod log;
3
4/// 去除字符串两端的引号(单引号或双引号)
5pub fn remove_quotes(s: &str) -> String {
6 let s = s.trim();
7 if s.len() >= 2 {
8 if (s.starts_with('\'') && s.ends_with('\'')) || (s.starts_with('"') && s.ends_with('"')) {
9 return s[1..s.len() - 1].to_string();
10 }
11 }
12 s.to_string()
13}