• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 750
  • Last Modified:

Format integer with leading zero into edit

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
ChLa
Asked:
ChLa
1 Solution
 
MerijnBSr. Software EngineerCommented:
Try:

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

Open in new window

0
 
ChLaAuthor Commented:
That did it. Thank you.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now