Created
May 1, 2018 13:25
-
-
Save Flayed/20c0721a3324bdad499158420f2c0691 to your computer and use it in GitHub Desktop.
Number padding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int myNumber = 42; | |
// Adjust the first parameter to PadLeft to adjust the number of zeroes | |
string serialNumber = $"AXT{myNumber.ToString().PadLeft(5, '0')}"; | |
// serialNumber = AXT00042 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment