encryptLetter function

int encryptLetter(
  1. int factor,
  2. String letter
)

This function gets the position of a letter in the alphabet.

Implementation

int encryptLetter(int factor, String letter) {
  int result = 1;
  List<String> myList = [
    'A',
    'B',
    'C',
    'D',
    'E',
    'F',
    'G',
    'H',
    'I',
    'J',
    'K',
    'L',
    'M',
    'N',
    'O',
    'P',
    'Q',
    'R',
    'S',
    'T',
    'U',
    'V',
    'W',
    'X',
    'Y',
    'Z'
  ];
  for (var i = 0; i < myList.length; i++) {
    if (myList[i] == letter) {
      result = (myList.indexOf(letter) + 1) * factor;
      break;
    } else {}
  }
  return result;
}