toDigitWithLetter static method
Converts a string to contain only digits and letters.
Example: 'abc123!@#' -> 'abc123'
Implementation
static String? toDigitWithLetter(String? value) {
if (value == null || value.isEmpty) return null;
String buffer = '';
for (String character in value.characters) {
if (Validator.isDigit(character) || Validator.isLetter(character)) {
buffer = '$buffer$character';
}
}
return buffer;
}