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
Convert a number to a string in the user's country format
Re: Convert a number to a string in the user's country format
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:
Hence I think you need to make one yourself.
I would suggest using something like:
Code: Select all
ConvertNumberToCountryFormat(number, country)
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Convert a number to a string in the user's country format
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…
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Convert a number to a string in the user's country format
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.
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Convert a number to a string in the user's country format
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