• 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
NSString floatValue issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString floatValue issue


  • Subject: NSString floatValue issue
  • From: "C Sandeep" <email@hidden>
  • Date: Tue, 26 Feb 2008 12:55:46 -0500

Greetings,
 I need to evaluate a NSString as a float value (represented by
NSNumber object). Here is my code snippet:

----
    NSString *str = @"28/5";
    NSNumber *nm = [NSNumber numberWithFloat:[str floatValue]];
    NSLog(@"number: %@", nm );
----

 this results in:

----
 number: 28.0
----

 However, I was expecting 5.6 as the result. How do I achieve this ? Thanks.

- Sandeep
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSString floatValue issue
      • From: Graham <email@hidden>
    • Re: NSString floatValue issue
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: NSString floatValue issue
      • From: Randall Meadows <email@hidden>
  • Prev by Date: Re: Nicely scaling a CALayer (interpolation?)
  • Next by Date: Re: NSURLConnection failing [SOLVED]
  • Previous by thread: Re: Responding To Screen Saver/Sleep Events
  • Next by thread: Re: NSString floatValue issue
  • Index(es):
    • Date
    • Thread