Page 1 of 1
Convert a number to a string in the user's country format
Posted: Tue Jul 27, 2021 3:09 pm
by mrupp
Hi there
I would like to convert to number to a string, but using the user's country format.
Example: 1234567.89
Should print for Germany: 1.234.567,89
but for England: 1,234,567.89
and for Switzerland: 1'234'567.89
I'm sure there must be a function to achieve this, I just can't find it on my own...

Cheers, Michael
Re: Convert a number to a string in the user's country format
Posted: Tue Jul 27, 2021 4:20 pm
by Bugala
My guess is there isnt such a command/function existing in Hollywoods functions. Not that it wouldn't be useful, but I think it is bit too software specific thing, and then there can be variations even inside software that would need it in different ways.
Hence I think you need to make one yourself.
I would suggest using something like:
Code: Select all
ConvertNumberToCountryFormat(number, country)
Re: Convert a number to a string in the user's country format
Posted: Wed Jul 28, 2021 10:22 pm
by airsoftsoftwair
mrupp wrote: ↑Tue Jul 27, 2021 3:09 pm there
I'm sure there must be a function to achieve this, I just can't find it on my own...
Actually, there isn’t. Localisation support is still somewhat limited in Hollywood because nobody has asked this before. Of course I fully agree that this is something this should be supported…
Re: Convert a number to a string in the user's country format
Posted: Sat Jan 14, 2023 10:12 pm
by airsoftsoftwair
Code: Select all
- New: Added GetLocaleInfo() function; this returns several pieces of information about the current user's
locale settings like decimal separator, thousand separator, date format, time format, weekday and month
names, currency symbols etc.
Re: Convert a number to a string in the user's country format
Posted: Sun Jan 15, 2023 1:12 pm
by airsoftsoftwair
Code: Select all
- New: Added FormatNumber() function; this can be used to convert a number to a string; in contrast to the
StrStr() function, FormatNumber() will separate the digits by the thousands and it's also possible to
specify a custom thousand separator and decimal point; this can be useful to convert numbers to strings
in a localized way