ruimpl/
lib.rs

1//! # ruimpl
2//!
3//! A library for rust utility implements.
4
5/// Remove EOL from the primitive [`str`].
6///
7/// # Examples
8/// ```rust
9/// use ruimpl::rmeol;
10///
11/// assert_eq!(rmeol("a"), "a");
12/// assert_eq!(rmeol("a\r\n"), "a");
13/// assert_eq!(rmeol("a\n"), "a");
14/// ```
15pub fn rmeol(r#str: &str) -> String {
16    r#str[..r#str.rfind("\r").unwrap_or(r#str.rfind("\n").unwrap_or(r#str.len()))].to_owned()
17}
18
19#[cfg(test)]
20mod tests {}