To show a comma separated number I set local as
setlocale(LC_NUMERIC, "en_US");
then compose a message
char msg[100]={0};
sprintf(msg,"Reach a score %'ld.",mission.param1);
mission.msg=msg;
Then I display this message as :
sprintf( msgStr,"%s",mission.msg.c_str());
_missionStatusLabel1=CCLabelTTF::create(msgStr, "MarkerFelt-Thin", 52 * _scaleY, CCSizeMake(1000 * _scaleX,0),
kCCTextAlignmentLeft);
_missionStatusLabel1->setPosition( ccp(_screenSize.width * 0.53f, _screenSize.height*0.704f) );
Problem is, on simulator it shows correct format like for 25000 it shows 25,000 but when I run on iPad(ios7) it simply show 25000 without comma.
what I may be missing ?
EDIT:
Or How would you show a comma separated number ?
As you can see In my code above I am setting locale using the c++ setLocale. But this code showed comma only in simulator but not actual device . So I tried NSNumberFormatter class and everything worked just perfect. I picked the code from NSNumberFormatter with comma decimal separator and just wrapped under c++ interface for use