hasWhitespace method
Checks whether the String
has any whitespace characters.
Example
String foo = 'Hello World';
bool hasWhitespace = foo.hasWhitespace; // returns true;
String foo = 'HelloWorld';
bool hasWhitespace = foo.hasWhitespace; // returns false;
Implementation
bool hasWhitespace() {
if (this.isBlank) {
return false;
}
return this.contains(RegExp(r'\s'));
}