title: Efficient method for converting text to phone keypad
body: <p>I have the following code for converting a string containing alphanumeric characters to a string of numbers that can be entered into a phone using the phone's keypad:</p>
  
  <pre><code>string text = "sometext containing spaces and numbers 12345";
  Dictionary&lt;char, char&gt; alphabetMapping = new Dictionary&lt;char, char&gt;();
  alphabetMapping['a'] = '2';
  alphabetMapping['b'] = '2';
  alphabetMapping['c'] = '2';
  alphabetMapping['d'] = '3';
  alphabetMapping['e'] = '3';
  alphabetMapping['f'] = '3';
  alphabetMapping['g'] = '4';
  alphabetMapping['h'] = '4';
  alphabetMapping['i'] = '4';
  alphabetMapping['j'] = '5';
  alphabetMapping['k'] = '5';
  alphabetMapping['l'] = '5';
  alphabetMapping['m'] = '6';
  alphabetMapping['n'] = '6';
  alphabetMapping['o'] = '6';
  alphabetMapping['p'] = '7';
  alphabetMapping['q'] = '7';
  alphabetMapping['r'] = '7';
  alphabetMapping['s'] = '7';
  alphabetMapping['t'] = '8';
  alphabetMapping['u'] = '8';
  alphabetMapping['v'] = '8';
  alphabetMapping['w'] = '9';
  alphabetMapping['x'] = '9';
  alphabetMapping['y'] = '9';
  alphabetMapping['z'] = '9';
  alphabetMapping['1'] = '1';
  alphabetMapping['2'] = '2';
  alphabetMapping['3'] = '3';
  alphabetMapping['4'] = '4';
  alphabetMapping['5'] = '5';
  alphabetMapping['6'] = '6';
  alphabetMapping['7'] = '7';
  alphabetMapping['8'] = '8';
  alphabetMapping['9'] = '9';
  alphabetMapping['0'] = '0';
  alphabetMapping['.'] = '0';
  alphabetMapping[','] = '0';
  alphabetMapping['@'] = '0';
  alphabetMapping['*'] = '*';
  alphabetMapping['#'] = '#';
  alphabetMapping[' '] = '0'; // not sure if this underscore or space
  
  StringBuilder sb = new StringBuilder();
  foreach (var c in text)
  {
      sb.Append(alphabetMapping[c]);
  }
  
  Console.WriteLine(sb.ToString());
  </code></pre>
  
  <p>The output:
  <code>76638398026682464640772237026306862377012345</code></p>
  
  <p>Not that this has much practical use, but some automated phone systems ask for passwords that may contain letters so I wrote this code for helping with that.</p>
  
  <p>Is there a more efficient method for this or am I on the right track?</p>