CodeBase - Pad Numerical Text With Leading Zeros

Return to the CodeBase listing

Category: Miscellaneous

Version: 1.0



Uploaded: 26th Dec 2022 04:15

Modified: 26th Dec 2022 19:30

Author:  Steve Ancell


A handy function for converting an integer to a string that's padded with leading zeros.

Full Description

After searching for a function in AGK that preserves zero spaces, and not getting what I wanted, I decided to make my own. Handy for when you want to show leading zeros for scoreboards or other integers in games, etc... Update: Phaelax pointed out that the Right() function can be used as a simpler method, it seems like the answer was staring me right in the face but I just didn't see the obvious. Both mine and Phaelax idea work fine, it's up to you which one suits you best.


No comments yet.