On Apr 13, 2010, at 5:50 PM, Murat Konar wrote:

> For one thing, the docs say that -setFormat: is for use with formatters using 
> NSNumberFormatterBehavior10_0 behavior.
> 
> Have you set the formatters behavior?


murat,

No, just the way the code showed. Here's from the docs :

-- From what I can see it should work out or the box ???

NSNumberFormatterBehavior10_0
The number-formatter behavior as it existed prior to Mac OS X v10.4.
Available in Mac OS X v10.4 and later.

I added : [NSNumberFormatter 
setDefaultFormatterBehavior:NSNumberFormatterBehavior10_0];
but it didn't help...

// 
+---------+---------+---------+---------+---------+---------+---------+---------+
+ (NSString *)bhFormatNumberString:(NSString *)aNumberString 
withFormat:(NSString *)aFormat
{
        NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] 
autorelease];

        [NSNumberFormatter 
setDefaultFormatterBehavior:NSNumberFormatterBehavior10_0];  
        [numberFormatter setFormat:aFormat];    // specify just positive values 
format
        
        NSInteger theInt = [aNumberString intValue];
        NSNumber *theNum = [NSNumber numberWithInt:theInt];
        NSString *theString = (NSString *)[numberFormatter 
stringFromNumber:theNum];
        NSLog(@"[4625] theString = %@", theString);
        
        return theString;
        // 
+---------+---------+---------+---------+---------+---------+---------+---------+
}


Bill Hernandez
Plano, Texas


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to