| |

VerySource

 Forgot password?
 Register
Search
View: 581|Reply: 1

Ask a long number formatting question, wait online ~~~

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-7 16:30:01
| Show all posts |Read mode
char * nn = "111222333.12345";
I want to get after conversion: nn = "111,222,333.12345";
That is, a comma is added to the integer part every 3 digits, and the decimal part is unchanged. Does anyone know?
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-4-13 21:45:01
| Show all posts
float num = 111222333.12345;
locale loc ("us");
strstream ss;
ss.imbue (loc);
ss << num;
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list