Typo and formatCurrencyDigits() optimization

Hello!

I've just found a typo and changed some code for better performance which is used for trimming zeros from the right side in formatCurrencyDigits().

Hope this is useful.

Thanks.