adding `trim_zeros` setting

I saw that the previous coding was trimming trailing zeros, but just one (".0"), so I replaced the code for this.

I thought about to use a ternary on checking for '', but I don't know how to do it.

Please, tell me if I can improve it more.