Solved

string format mask using xcode

Posted on 2011-09-26
3
824 Views
Last Modified: 2012-05-12
Dear all,

i need to show numbers in label using xcode i managed to do this but i need this two decimal digits like 01 , 02 or 03 anything like that how we can do this using xcode.

Best regards
0
Comment
Question by:deniro1974
3 Comments
 
LVL 13

Assisted Solution

by:SpeedyApocalypse
SpeedyApocalypse earned 250 total points
ID: 36602595
If you want to get 2 decimal digits from a float, you can use "0.2f".

For example:

[NSString stringWithFormat:@"A formatted float: 0.2f",84.246424];

Open in new window

0
 

Author Comment

by:deniro1974
ID: 36707640

OK thanks but what if i want to show any integer as two digits like if 1 will show 01 if 2 will show 02 if 10 will be 10 no change, i want it for integer.

0
 
LVL 5

Accepted Solution

by:
mad_mac earned 250 total points
ID: 36708640
[NSString stringWithFormat:@"A zero padded integer: %02d", 2];

Open in new window

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Create a default user profile for Mac OS X 10.7/10.8 Create a user account on OS X that will be a template for every other user of that computer. I usually call it “profile” and make it an administrator account for the time being. 1. Install a…
A lot of new and distinct gadgets are making their appearance every other day. The latest gadget that has wooed the attention of all gadget lovers and non gadget lovers alike is the Smartwatch. This tiny gadget is capable of offering live access to …
Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question