unmaskValue function

String unmaskValue(
  1. String mask,
  2. String maskedValue
)

used to reverse the value from an mask_formatter controller

Implementation

String unmaskValue(String mask, String maskedValue) {
  String specialCharacters = '0A@*';
  String unmaskedValue = '';

  for (int i = 0; i < min(mask.length, maskedValue.length); i++) {
    if (specialCharacters.contains(mask[i])) unmaskedValue += maskedValue[i];
  }

  return unmaskedValue;
}