title: How to convert string to int with error handling?
body: <pre><code>value = (int)'0'; //0;
  value = (int)'error message'; //0  
  </code></pre>
  
  <p>The same with intval. </p>
  
  <p>But 0 is the valid integer, why do they return it in case of error? How to avoid it?  </p>