Function textwrap::dedent [] [src]

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

Removes common leading whitespace from each line.

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

use textwrap::dedent;

assert_eq!(dedent("  1st line\n  2nd line\n"),
           "1st line\n2nd line\n");