Easier way to convert this.....
-
Hello, I was wondering if anyone had a good idea on how to convert the following... CString strN; strN.Format("%d", nNum); // where nNum is something like 1123456 I would like to see the output of strN equal "1,123,456" Is there a easy way to do this? Rob Whoever said nothing's impossible never tried slamming a revolving door!
-
Hello, I was wondering if anyone had a good idea on how to convert the following... CString strN; strN.Format("%d", nNum); // where nNum is something like 1123456 I would like to see the output of strN equal "1,123,456" Is there a easy way to do this? Rob Whoever said nothing's impossible never tried slamming a revolving door!
Someone mentioned the API
GetNumberFormat
a few days ago. It's the fancy way of doing it. I'm sure you can whip up a quickfor
loop that will do it just as well. Regards, Alvaro
Hey! It compiles! Ship it.
-
Hello, I was wondering if anyone had a good idea on how to convert the following... CString strN; strN.Format("%d", nNum); // where nNum is something like 1123456 I would like to see the output of strN equal "1,123,456" Is there a easy way to do this? Rob Whoever said nothing's impossible never tried slamming a revolving door!
Why don t u just put a comma after the third, the sixth... char? Just make a loop which every 3 char inserts a comma with CString::Insert for instance. Something like this: for(i,from begining to the end of the cstring) { if(i==3or6or9) urstring.insert(",") //not the good syntax but u get the idea across } Is it what u meant? hope it s of any help 2 u. syl sysy