subgraph/utils/clean_string/
mod.rs1#[derive(Debug, Clone)]
2pub struct CleanOptions {
3 pub newline: Option<bool>,
4 pub quotes: Option<bool>,
5}
6
7pub fn clean_string(v: &String, options: Option<CleanOptions>) -> String {
8 let mut v = v.clone();
9 let opts = if options.is_none() {
10 CleanOptions {
11 newline: Some(true),
12 quotes: Some(true),
13 }
14 } else {
15 options.unwrap()
16 };
17 if opts.newline.unwrap_or(false) {
18 v = v.replace("\n", "")
19 }
20 if opts.quotes.unwrap_or(false) {
21 v = v.replace("\"", "")
22 }
23 v
24}