Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
The setFormat: is not supported on iPhone for some unknown reason but that should take care of what you need. For a number with decimal values you can change the value in [frm setMaximumFractionDigits:0]
Hi, I also ran into similar kind of problem few days ago... As JoeBlaze stated setFormat is not supported on iphone...works fine on simulator but not for iphone..
In the code that you both provided where do I put the input (amount) and the output (NewAmount.text)?
Many thanks in advance......
Henry
snehal;56763 said:
Hi, I also ran into similar kind of problem few days ago... As JoeBlaze stated setFormat is not supported on iphone...works fine on simulator but not for iphone..
so NSFormatter would give me (hopefully) something like 000,123,456 and I replace "," by "." or "-"... but if some one has a diffrent localisation, this method would fail due to missing "," (like in germany they have "." and in other countries there might be nothing.)
[NSFormatter setThousandSeperator:] does not function on iPhone OS - so how to fix this glitch?
I would apprechiate any help! thanx in advance, sendel.
PS:
Haoshiro;82942 said:
That code will cause your app to crash because it's not allocating/initializing the formatter object.
You should also release the numFormatter. Otherwise frequent calls to this formatter thing (like updating your score) would also crash your application due to memory leaks.
Add this at the bottom of the above code to fix this:
[numFormatter release];
Always think of no1 rule : "If I call alloc, I have to call release, too."
Hi, I also ran into similar kind of problem few days ago... As JoeBlaze stated setFormat is not supported on iphone...works fine on simulator but not for iphone..
If we implement the code the text field is taking only 4 values and when the 5th button is pressed it is again starting with the 5th value but the comma is getting displayed properly. PLese help me out and i want to enter multiple values till 16
Hi, I also ran into similar kind of problem few days ago... As JoeBlaze stated setFormat is not supported on iphone...works fine on simulator but not for iphone..
If we implement the code the text field is taking only 4 values and when the 5th button is pressed it is again starting with the 5th value but the comma is getting displayed properly. PLese help me out and i want to enter multiple values till 16
Hello JoeBlaze, I tried your code, but my value is 999999999999999999.99 .I change the data type with NSDecimalNumber, but when I want to display it as string, the value always rounded to 1000000000000000000.00
My expectation is the result string show original value (not rounded value). Can you help me to solve this problem?
The setFormat: is not supported on iPhone for some unknown reason but that should take care of what you need. For a number with decimal values you can change the value in [frm setMaximumFractionDigits:0]
Replies
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeCheers
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThanks
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThe setFormat: is not supported on iPhone for some unknown reason but that should take care of what you need. For a number with decimal values you can change the value in [frm setMaximumFractionDigits:0]
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeI also ran into similar kind of problem few days ago...
As JoeBlaze stated setFormat is not supported on iphone...works fine on simulator but not for iphone..
This is what i had done to solve the problem
And it worked for me on iphone ;)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeIf my current formatter is:
NewAmount.text = [NSString stringWithFormat:@"%2.2f", amount];
In the code that you both provided where do I put the input (amount) and the output (NewAmount.text)?
Many thanks in advance......
Henry
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeUse this instead:
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomelets say I have a value : 123456
and my output should be something like :
SCORE: 000-123-456
or
SCORE: 000.123.456
This is what google told me to do:
[NSFormatter setThousandSeperator:@"-"];
but unfortunatelly this doesn't work on iPhone OS because there is a code line :
Bummer!
so, I hacked a work around, which helps me to continue coding... but I want to fix this Hack before I release the app.
my current code is :
so NSFormatter would give me (hopefully) something like 000,123,456 and I replace "," by "." or "-"... but if some one has a diffrent localisation, this method would fail due to missing "," (like in germany they have "." and in other countries there might be nothing.)
[NSFormatter setThousandSeperator:] does not function on iPhone OS - so how to fix this glitch?
I would apprechiate any help!
thanx in advance,
sendel.
PS: You should also release the numFormatter. Otherwise frequent calls to this formatter thing (like updating your score) would also crash your application due to memory leaks.
Add this at the bottom of the above code to fix this:
Always think of no1 rule : "If I call alloc, I have to call release, too."
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeMy expectation is the result string show original value (not rounded value). Can you help me to solve this problem?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeI'm trying to format the number with thousands separator AND decimal WITHOUT it rounding off my decimals (x,xxx.xx). Any help would be great!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome