Converting decimals to words


I’m using the pluging Number to Words, which does not convert decimals, so 10.5 would be “ten and 50/100” whereas I need it to be “ten dollars and fifty cents”. Hence I need to use the plugin twice, one for the integers, and the other for the cents.

Now I don’t know how to get the decimals or integer out of the 10.5. The floor and ceiling functions will do some rounding. What I need is truncating, but this function doesn’t exist.

I tried to convert the number to integer using the formatting as (zero decimals) and then back to number, but I am getting rounding again! (Why is there no option for not rounding?)

What can be done?

I found the solution. I formatted the number with decimals like 10.50 and did a regex extract with rexpression ^[0-9]+ and then converted back to number.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.