1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Utility for cleaning up strings.
//!
//! This module provides functions to remove unnecessary spaces and
//! enclosing quotation marks from strings, which is particularly important when parsing
//! user input or configuration values.
/**
* trim_and_clean.rs
*
* (C) Copyright 2026 AtlantisOS Project
* by @NachtsternBuild
*
* License: GNU GENERAL PUBLIC LICENSE Version 3
*/
/// Removes leading and trailing whitespace as well as enclosing quotation marks.
///
/// The function operates efficiently on string slices (`&str`), so no
/// new string allocations in memory are required.
///
/// # How it works
/// 1. First, all whitespace at the beginning and end is removed (`trim`).
/// 2. If the remaining text begins **and** ends with `"`, these
/// two characters are removed.
///
/// # Arguments
/// * `s` - The string to be cleaned.
///
/// # Return Value
/// A cleaned string slice.
///
/// # Usage:
///
/// ```rust
/// fn main() {
/// let input = " \"Hello AtlantisOS\" ";
/// let cleaned = trim_and_clean(input);
/// println!("Input: |{}|", input);
/// println!("Output: |{}|", cleaned);
/// }
/// ```