Digit grouping using formatting culture


I am using the culture component to try and have digit grouping (per 1000). The the value in the image below should be ‘47,980’.

I’m using the UK which I though would do this, but it isn’t making a difference. Is it the LCID value that controls how data is formatted and if so, where is this documented?



@DavidRutten can you help with this please

@wim can you help with this please.

Have a look at stack overflow
Python thousands separators

I haven’t tried this but looks like a simple format operation "{:,}".format(value)

@dharman I know it is possible to use the format operation but the culture component apparently can be used instead: https://ieatbugsforbreakfast.wordpress.com/tag/culture/

I just can’t find any information about how it works. It is wired up correctly but it is not formatting as I would like.

Hi Paul,
It seems like the Culture component is doing something but perhaps not all as advertised:
I’ll try to find out more and file bug reports as needed.

Hi @parametricmonkey1,

The Format component seems to be derived from C# string formatting (cf. String.Format method reference).

Its F input needs a text format, defined as follows:


The zero-based index of the argument, whose string representation is to be included at this position in the string. (If this argument is null, an empty string will be included at this position in the string.) This specifies, where your data from input 0 is going to be placed in the new, formatted string.


An optional signed integer that indicates the total length of the field into which the argument is inserted and whether it is right-aligned (a positive integer) or left-aligned (a negative integer). If you omit alignment, the string representation of the corresponding argument is inserted in a field with no leading or trailing spaces.
If the value of alignment is less than the length of the argument to be inserted, alignment is ignored and the length of the string representation of the argument is used as the field width.


Optional. A string that specifies the format of the corresponding argument’s result string. If you omit formatString, the corresponding argument’s parameterless ToString method is called to produce its string representation. If you specify formatString, the argument referenced by the format item must implement the IFormattable interface, which is especially handy for you!

You script could look like this:

However, I’m not sure what the Culture C input really provides here, since it seems to be no substitute for the Text Format F.
One more thing to note is, that when applying a formatString, you need to input your data as a type, supported by the formatString (cf. IFormattable interface above).
I’ve for instance inputted 47980, which was output as a string from the Panel, as an integer!

If you want culture-specific thousand separators, include a comma in the format before the decimal point symbol.

In the attached file you can see various formatting rules: formatting.gh (13.2 KB)

  1. Default formatting (will eventually round I believe or even switch to scientific notation)
  2. Forces a single (rounded) decimal digit.
  3. Includes thousand grouping and no decimals.
  4. Includes thousand grouping and at least one decimal. Two more decimals will be included but not including trailing zeroes.
  5. Exponential notation, also known as scientific notation.
  6. ‘Roundtrip’ formatting, ensures no information is lost during formatting due to rounding.

Thanks @DavidRutten.

The formatting input is now clear. But I’m still not really sure what the culture input is providing. I was under the impression that depending on the culture selected, digit grouping would be automatic. But this isn’t the case. Is the only thing that the culture input is providing is if the number uses a comma or point to denote a decimal?

Hi Paul - I’m not sure either exactly what Culture is providing, but…

No, also the character for thousand grouping is provided by the component:

1 Like