bpt 0.1.6

Bedrock Linux package manager
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Removes comments and trims whitespace from a string.
///
/// Does not support escaped comments.
pub trait StripComment {
    fn strip_comment(&self) -> &str;
}

impl StripComment for str {
    fn strip_comment(&self) -> &str {
        match self.split_once('#') {
            Some((precomment, _)) => precomment.trim(),
            None => self.trim(),
        }
    }
}