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