Macro const_str::squish

source ·
macro_rules! squish {
    ($s:expr) => { ... };
}
Expand description

Splits the string by ASCII whitespaces, and then joins the parts with a single space.

§Examples

use const_str::squish;

assert_eq!(squish!("   SQUISH  \t THAT  \t CAT!    "), "SQUISH THAT CAT!");

const SQL: &str = squish!(
    "SELECT
        name,
        created_at,
        updated_at
    FROM users
    WHERE id = ?"
);
assert_eq!(SQL, "SELECT name, created_at, updated_at FROM users WHERE id = ?");