compact function

String compact(
  1. String str
)

Compact a string (replacing all whitespace with single spaces.)

Implementation

String compact(String str) {
	return str.split(RegExp(r"\s+")).join(" ");
}