string to numbers utility method