Solved

string format mask using xcode

Posted on 2011-09-26
3
821 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
Comment Utility
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
Comment Utility

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
Comment Utility
[NSString stringWithFormat:@"A zero padded integer: %02d", 2];

Open in new window

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Information security is a multi-billion dollar industry. Just as lucrative is the black market industry which trades stolen identities, credit card numbers and software exploits all over the world. Nothing is hack-proof. The best one can do is make …
CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
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 > …
Users will learn how to set proper sequence settings, scale images, paste attributes, add transitions, fades, and music. Open up Final Cut Pro 7 and Create a new Project: Set the Sequence Settings. a) Click File > Easy Setup > Format > Apple ProRe…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now