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?
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.
Thanks!
Its F input needs a text format, defined as follows: {index[,alignment][:formatString]}
index
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.
alignment
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.
formatString
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!
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!
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?