removeSpecial property
String?
removeSpecial
Returns all special characters from the String
.
Example
String foo = '/!@#\$%^\-&*()+",.?":{}|<>~_-`*%^/ese?:"///ntis/!@#\$%^&*(),.?":{}|<>~_-`';
String removed = foo.removeSpecial; // returns 'esentis'
Implementation
String? get removeSpecial {
if (this.isBlank) {
return this;
}
// ignore: unnecessary_raw_strings
var regex = RegExp(r'[/!@#$%^\-&*()+",.?":{}|<>~_-`]');
return this!.replaceAll(regex, '');
}