onlyLatin property
String?
onlyLatin
Returns only the Latin characters from the String
.
Example
String foo = '4*%^55/es4e5523nt1is';
String onlyLatin = foo.onlyLatin; // returns 'esentis'
Implementation
String? get onlyLatin {
if (this.isBlank) {
return this;
}
// ignore: unnecessary_raw_strings
var regex = RegExp(r'([^a-zA-Z\s]+)');
return this!.replaceAll(regex, '');
}