Skip to main content

j_cli/util/
mod.rs

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