obfocustData method

String obfocustData({
  1. required String mystring,
  2. int start = 5,
  3. int end = 5,
})

Implementation

String obfocustData({
  required String mystring,
  int start = 5,
  int end = 5,
}) {
  String message = "";
  int num_start = start;
  int num_end = mystring.length - end;
  if (num_end < 1) {
    num_end = mystring.length - 2;
  }
  for (int i = 0; i < mystring.length; i++) {
    var loop_data = mystring[i];
    if (i == num_end) {
      num_end--;
      message += loop_data;
    } else if (i == num_start) {
      num_start++;
      message += "*";
    } else {
      message += loop_data;
    }
  }
  return message;
}