Solved

Format integer with leading zero into edit

Posted on 2013-11-04
2
721 Views
Last Modified: 2013-11-04
Hi,
I'm trying to format an integer with a leading zero before copying to an edit. I have an integer value which can be between 0 and 99. I want to format it with a leading zero and put it into a memo so that a 0 through 9 would appear as 00 through 09. Here is what i have tried:
Edit17.Text := Format('',[MyInteger]);
Edit17.Text := (Format('',[2, MyInteger]));
I've tried several different combinations of this with no luck. It keeps comming back with no leading zero. What do I need to do ?
0
Comment
Question by:ChLa
2 Comments
 
LVL 19

Accepted Solution

by:
MerijnB earned 500 total points
ID: 39622934
Try:

Edit17.Text := Format('%.2d', [MyInteger]);

Open in new window

0
 

Author Closing Comment

by:ChLa
ID: 39623218
That did it. Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

12 Experts available now in Live!

Get 1:1 Help Now