IoT Inspector Interview Question

Write a digit parser with error tolerance supporting different bases.