Solved

string format mask using xcode

Posted on 2011-09-26
3
830 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
[X]
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
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

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MAC Book Pro Keyboard/Trackpad 3 101
How do i learn Story Board for IOS ? 3 158
Apple macbook will not count battery cycles 3 72
Using Mac OSX on Windows 7 Professional 4 100
iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
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…
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…

738 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