Function textwrap::dedent[][src]

pub fn dedent(s: &str) -> String

Removes common leading whitespace from each line.

This function will look at each non-empty line and determine the maximum amount of whitespace that can be removed from all lines:

use textwrap::dedent;

assert_eq!(dedent("
    1st line
      2nd line
    3rd line
"), "
1st line
  2nd line
3rd line
");