• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why is "." a decimal number? (NSScanner question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is "." a decimal number? (NSScanner question)


  • Subject: Why is "." a decimal number? (NSScanner question)
  • From: Jim Rankin <email@hidden>
  • Date: Fri, 4 Jun 2004 15:38:27 -0400

Why does NSScanner consider "." to be a decimal number? The following
program:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSDecimal d;
NSScanner *dotsScanner = [NSScanner scannerWithString:@"...."];

while ([dotsScanner scanDecimal:&d])
NSLog(@"scanned %@", [NSDecimalNumber
decimalNumberWithDecimal:d]);

[pool release];
return 0;
}

gives the following output:

2004-06-04 15:34:59.039 dotIsAdecimalNumber[1252] scanned 0
2004-06-04 15:34:59.041 dotIsAdecimalNumber[1252] scanned 0
2004-06-04 15:34:59.041 dotIsAdecimalNumber[1252] scanned 0
2004-06-04 15:34:59.041 dotIsAdecimalNumber[1252] scanned 0

dotIsAdecimalNumber has exited with status 0.

Does anyone ever write "." and expect it to be interpreted to mean "0"?
Or is this a bug?

Thanks,
-jimbo

Excelsior! XML Marshaller for Cocoa
http://www.homepage.mac.com/jimbokun/Excelsior.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Why is "." a decimal number? (NSScanner question)
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: Modal Window? Sheet? What do I need...
  • Next by Date: Re: embedding the DisclosableView framework
  • Previous by thread: Re: Changing an NSImageView's NSImage
  • Next by thread: Re: Why is "." a decimal number? (NSScanner question)
  • Index(es):
    • Date
    • Thread