What is the better & short way to code this snippet?
let html = r#"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<!-- This is Comment -->
<a href="/nofollow" ref="nofollow">No Follow</a>
<a href="/follow" ref="follow">Follow</a>
</body>
</html>
"#;
let html: String = html
.chars()
.filter(|c| *c != '\n')
.filter(|c| *c != '\t')
.collect();
let html: String = html
.split(' ')
.map(|c| c.trim())
.filter(|c| c.len() > 0)
.map(|c| format!("{0} ", c))
.collect();
println!("{:?}", html);
Please let me know.
Thank you