• 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
Padding Zeros...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Padding Zeros...


  • Subject: Padding Zeros...
  • From: Jean-Nicolas Jolivet <email@hidden>
  • Date: Fri, 31 Oct 2008 17:52:30 -0400

I'm having an interesting problem... I'm trying to format a number with padding zeros but I can't figure out how to do it in this particular situation.

I know I can use a formatted string with something like [stringWithFormat:@"d", 5], which would result in 005 but the problem in this particular case is that the number of padding zeros (3 in my example) is a variable defined by the user... (let's say it resides in an int variable named "int paddingZeros"....)

Is there an easy way I can pad a number with a variable amount of zeros?

Jean-Nicolas Jolivet
_______________________________________________

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: Padding Zeros...
      • From: Jean-Nicolas Jolivet <email@hidden>
    • Re: Padding Zeros...
      • From: Randall Meadows <email@hidden>
    • Re: Padding Zeros...
      • From: "Shawn Erickson" <email@hidden>
    • Re: Padding Zeros...
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Detecting when NSComboBox text changed by list
  • Next by Date: Re: Detecting when NSComboBox text changed by list
  • Previous by thread: Re: Number in NSString to int.
  • Next by thread: Re: Padding Zeros...
  • Index(es):
    • Date
    • Thread