Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

string format mask using xcode

Posted on 2011-09-26
3
827 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iOS and VPN 6 163
iTunes problem 5 80
Save Excel documents to PDF and RETAIN color 16 220
My MacBook is dogging... 4 57
Hi Folks, This article is intended to throw some light or basically give an idea towards taking the first step in the world of Systems Administration. This would in the real context of the word "Systems Administration" which would mean right from…
A common question or need, when setting-up a new Mac for someone would be to make all of the applications, installed, available from the dock. Many people often do not realize an application is installed unless it is in the dock. Creating a custo…
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…

791 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