Add trimLength to trim all but the last character of the detected
integers in text form. The last character is not trimmed during
recursion because it may be part of the next integer.
This should reduce the amount of recursion needed to complete the
calculation.