title: truncate integer left in c++ or generic example
body: <p>Is there an alegant way to truncate integer in left direction decimal or base-independent? </p>
  
  <p>For example I have:</p>
  
  <pre><code>unsigned int val1 = 17301;
  </code></pre>
  
  <p>The algorithm must by one call truncate 1 (decimal)digit from left so for val1 the result of 4 calls would be:</p>
  
  <pre><code>truncate_left(17301) returns 7301
  truncate_left(7301) returns 301
  truncate_left(301) returns 1
  truncate_left(1) returns 0
  </code></pre>
  
  <p>The return value is integer also. The c/c++ solution is best for me. Any external (and/or) math libraries are not wellcome, I'm interested in generic way to do it</p>
  
  <p>@ATaylor
  my ugly solution was:</p>
  
  <pre><code>unsigned int truncate_left(unsigned int val) {
    unsigned int divider = 1000000000, dec;
    for(unsigned int pow10 = 10; pow10 &gt; 0; pow10--) {
      if(val % divider != val) {
        dec = val / divider;
        printf("dec = %d\n", divider);
        break;
      }
      divider /= 10;
    }
    return val - dec * divider;
  }
  </code></pre>
  
  <p>Thanks!</p>