Questions tagged [digit-separator]

30 questions
65
votes
9 answers

Add 'decimal-mark' thousands separators to a number

How do I format 1000000 to 1.000.000 in Python? where the '.' is the decimal-mark thousands separator.
CarlosRibet
  • 781
  • 1
  • 5
  • 5
42
votes
3 answers

Are C++14 digit separators allowed in user defined literals?

While clang compiles the following line, g++ 6.1 complains about the digit separator (see live example on Coliru): auto time = 01'23s; Which compiler, if any, is correct according to the C++14 standard (N3796)? Otherwise, is allowing digit…
8
votes
1 answer

Are digit separators allowed before the digits in a hex or binary number?

C++14 introduced the concept of digit separators into literals, along the lines of 3'141'592'653'589. Now this is a great feature for readable code but I was wondering whether it allowed quotes before the numeric portion of a 0x/0b-type literal. It…
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
7
votes
2 answers

How can I change the (locale) thousands separator in Python to Arabic Unicode separator?

I'd like to change the thousands separator such that {:,}.format(1234) in Python uses a different character. The separator should be '\u066c'. How can I set this without affecting any other locals settings? EDIT: Any other suggestion for a…
Gere
  • 12,075
  • 18
  • 62
  • 94
4
votes
1 answer

How to force dot on thousands separator?

I already saw a lot of question teaching how easy is to do it with comma as thousands separator: >>> format(1123000,',d') '1,123,000' But if I try to use a dot, it goes nuts: >>> format(1123000,'.d') ValueError: Format specifier missing…
Evandro Coan
  • 8,560
  • 11
  • 83
  • 144
3
votes
1 answer

Go/Golang: how to extract least significant digits from big.Float?

In Go/Golang I have a variable of type big.Float with an (arbitrary) precision of 3,324,000 to represent a decimal number of 1,000,000 digits. It's the result of an iteration to calculate pi. Now I want to print out the least significant 100 digits,…
tux4u2
  • 43
  • 5
3
votes
2 answers

How do I get the Blazor Client browser selected language? (So I can use the right decimal separator for calculations on that client browser)

I try to show and use the right digit separator depending on the clients browser selected language. I'm using a Blazor Server App. I've tried to use the 'Sytem.Globalization' namespace but this only shows the settings of the Server Side browser. Is…
3
votes
2 answers

How do user-defined literals play together with digit separator?

I was just modifying an old example of my code by adding a digit separator to a user-defined literal, parsed by a variadic template: namespace lits { // helper for 1 arg template int bin(); // common template<> int bin<'1'>() {…
towi
  • 21,587
  • 28
  • 106
  • 187
2
votes
1 answer

How to configure thousand separator for hovertext in R plotly?

It looks like a simple task, but after hours looking aroung I'm not able to find a suitable solution. I'm using plotly to plot line and bar charts, and I have trouble formatting hover numbers. I want the following : decimal separator ',' thousand…
2
votes
2 answers

How to replace commas with dots and vice versa

I have a string with this value: $myValue = "1.099,90"; And I want to replace commas with dots and vice versa. Just like this: $myNewValue = "1,099.90"; I know that there must be other better ways of doing this, but all I can get is: $myNewValue =…
1
vote
1 answer

How to add thousands separator to numbers in realtime for calculator app. KOTLIN

I have a calculator app and I want it to show large numbers with spaces between them when users enter their input in real time and when the calculator gives a number greater than 999. Currently, they don't have spaces between them like this: 10000;…
1
vote
0 answers

Gnuplot decimal separator of the input data

How can I change the decimal separator of the input data for the gnuplot from the default period '.' to the comma ','? As far as I have found, command 'set locale' can be used. However, the problem is to find the locales, available for the gnuplot…
Borys L.
  • 145
  • 1
  • 9
1
vote
0 answers

Inconsistent culture - decimal separator ignored in model binding between razor view and viewmodel

I have the following behaviour in my program: User input for a decimal variable A) jquery validation turned off: 1) If the user uses a comma as decimal separator, the value is stored correctly in the ViewModel 2) If the user uses a point as…
1
vote
1 answer

Format integer number with . as thousand separator and no decimals

I want to print a number with no decimals and a . as the thousand separator. All the example I could Google have a , as a thousands separator. I've set the CultureInfo to "nl-NL" So 3200 should be shown as 3.200 I tried: "3200".ToString("N2") …
Adam
  • 6,041
  • 36
  • 120
  • 208
1
vote
1 answer

Formatting integers with space as thousands separator

I wanted 1000 to look like 10 000. There are tons of examples to make a separator but they all show you how to start using comma or some StringLocal. How do I use space instead? Which locale should I use? I have already explained how mine question…
1
2