• 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
Re: NSString's intValue method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString's intValue method


  • Subject: Re: NSString's intValue method
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 19 Apr 2004 12:52:48 +0200

On 19.4.2004, at 12:41, p3consulting wrote:

> - (unsigned int)uintValue
> {
> return strtoul([self cString], NULL, 10);
> }

[self UTF88String] may be somewhat better in the long prospect perhaps:
cString has been marked as deprecated, so it may disappear sooner or
later.

Besides, there's another issue with cString: may raise a
NSCharacterConversionException, even in a completely valid (from the
uintValue point of view) situations. Also it is arguable whether the
possible inefficiency of using an NSScanner would not be more
acceptable than the possible inefficiency of translating a whole,
possibly pretty long string: it depends on your programming habits, I
guess ;)

Finally, much better name for the method might be unsignedIntValue, to
keep consistency and polymorphism:

unsigned u=[o unsignedIntValue]; // would work all right regardless o
is NSNumber or NSString
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


References: 
 >NSString's intValue method (From: Matt Jaffa <email@hidden>)
 >Re: NSString's intValue method (From: p3consulting <email@hidden>)

  • Prev by Date: Re: NSString's intValue method
  • Next by Date: Re: NSString's intValue method
  • Previous by thread: Re: NSString's intValue method
  • Next by thread: Re: NSString's intValue method
  • Index(es):
    • Date
    • Thread