So if I understand correctly (it works in my testing, but I wanted to
make
sure), I should change things to:
if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember: '0'])
// if not '0' based, don't trim
{
aString = [*fromString
stringByTrimmingCharactersInSet:[NSCharacterSet
characterSetWithCharactersInString:@"0"]]; // strip trailing zero's
// Note: can't strip both 0's and decimal point at the same time
because it
// will overstrip--turing 10000.00 into 1, while we want it 10000
aString = [aString stringByTrimmingCharactersInSet:[NSCharacterSet
characterSetWithCharactersInString:(NSString *)[[NSUserDefaults
standardUserDefaults] objectForKey:NSDecimalSeparator]]];
// now strip trailing decimal point
*fromString = aString;
}
Be careful when using stringByTrimmingCharactersInSet as it will trim
from _both_ ends of the receiver.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden