trimAll property
String
trimAll
Trims leading and trailing spaces from the String
, so as extra spaces in between words.
Example
String text = ' esentis thinks ';
String trimmed = text.trimAll ; // returns 'esentis thinks'
Implementation
String get trimAll {
if (this.isBlank) {
return this;
}
return this.trim().replaceAll(RegExp(' +'), ' ');
}