title: Convert a string to integer in C#/.NET
body: <p>I need to convert a string to integer. My string can be of any type (float/int/string/special character).</p>
  
  <p>For example:</p>
  
  <pre><code>If my string is "2.3", I need to convert to = 2
  If my string is "anyCharacter", I need to convert to = 0
  If my string is "2", I need to convert to = 2
  </code></pre>
  
  <p>I tried the following:</p>
  
  <pre><code>string a = "1.25";int b = Convert.ToInt32(a);    
  </code></pre>
  
  <p>I got the error:</p>
  
  <blockquote>
    <p>Input string was not in a correct format</p>
  </blockquote>
  
  <p>How do I convert it?</p>