getCharFromString function
getCharFromString method this method will return characters from string passed
Implementation
String getCharFromString({required String stringToExtract}) {
if (stringToExtract.isEmpty) {
return 'String passed cannot be empty';
}
const Pattern pattern = '[^A-Za-z]';
final RegExp regex = RegExp(pattern as String);
return stringToExtract.replaceAll(regex, ' ');
}