Solved

Format integer with leading zero into edit

Posted on 2013-11-04
2
716 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
Comment Utility
Try:

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

Open in new window

0
 

Author Closing Comment

by:ChLa
Comment Utility
That did it. Thank you.
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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

772 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

11 Experts available now in Live!

Get 1:1 Help Now