bigluck / alfred2-currencyconverter

A simple Alfred 2 Currency Converter workflow
153 stars 31 forks source link

Run result through `number_format` to get thousand separators #21

Open sorbits opened 7 years ago

sorbits commented 7 years ago

This makes it easier to read large numbers, e.g. 1,432,678,321.

Without additional arguments number_format will use commas for thousand separates, if you think this may confuse people who run macOS with a different locale setting then I suggest using a thin space (U+2009) as a workaround for (presumably) being unable to get the system’s configured thousand separator.

I was considering also running the suggestion through number_format, e.g. writing currency 50000 D will show 50000 DKK which I would like to see as 50,000 DKK, but that requires a bit of refactoring, as the suggestion is returned from a helper function and used both as title and what is inserted for auto-completion.

cgjosephlee commented 7 years ago

The decimal places are gone. And is it possible to imply inputing numbers with delimiters?

sorbits commented 7 years ago

I updated the commit to keep two decimals.

For input, I have not looked at that part of the source.