title: Replace letters in a string with numbers depending on the letter with Character class
body: <p>I am trying to write a program that accepts a phone number with letters in it and outputs the phone number with all digits. The digits that replace the letter are determined by the following key.</p>
  
  <pre><code>0 = none | 1 = none | 2 = ABC
  3 = DEF  | 4 = GHI  | 5 = JKL
  6 = MNO  | 7 = PQRS | 8 = TUV
           | 9 = WXYZ |
  </code></pre>
  
  <p>So if I got the phone number: </p>
  
  <pre><code>1-800-KILLERS
  </code></pre>
  
  <p>The output would be:</p>
  
  <pre><code>1-800-545-5377 
  </code></pre>
  
  <p>This is what I have so far. I haven't written out all of the cases for the switch statement but they would all go along the lines of the first cases, a,b and c.  </p>
  
  <pre><code>public static void main(String[] args) {
      Scanner stdin = new Scanner(System.in);
      System.out.println("Enter a phone number or quit to exit");
      String number = stdin.nextLine();
      System.out.println(getNumber(number));
  }
  
  public static int getNumber(String num) {
     for (int i = 0; i &lt; num.length() ; i++) {
         if (Character.isLetter(i) ) {
             switch (num.charAt(i)) {
                 case 'A':
                 case 'C':
                      num.charAt(i) = "2" ;
                      break;
                 // etc
              }
          }
      }
  }
  </code></pre>