• 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: Limiting a float
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limiting a float


  • Subject: Re: Limiting a float
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Thu, 28 Aug 2003 15:30:15 +0200

At 16:05 Uhr -0700 27.08.2003, Emig 647 wrote:
I send the result to an NSTextField as a float...

The problem is the float is sent as 17.340209972309 and I want to limit it
to 2 places to the right of the decimal...

Use [NSString stringWithFormat: @"%f.2", myFloat] and pass that to the text field's setStringValue:. (The format string is from memory. Look up printf-style format strings in your ANSI reference if it doesn't work the way you want)
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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: Limiting a float
      • From: Michael Tsai <email@hidden>
    • RE: Limiting a float
      • From: "Jonathan E. Jackel" <email@hidden>
References: 
 >Limiting a float (From: Emig 647 <email@hidden>)

  • Prev by Date: Re: Notification of Front Process Changed ?
  • Next by Date: Re: Sorry, should have said iconcomposer
  • Previous by thread: Re: Limiting a float
  • Next by thread: RE: Limiting a float
  • Index(es):
    • Date
    • Thread