KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I apply a mask to a string aiming to format the output text in the following fashion (at most 2 leading zeros): int a = 1, b = 10, c = 100; string aF = LeadingZeroFormat(a), bF = LeadingZeroFormat(b), cF = LeadingZeroFormat(c); Console.Writeline("{0}, {1}, {2}", aF, bF, cF); // "001, 010, 100" What is the most elegant solution? Thanks in advance.
Tags (comma-separated)
Save Edits
Cancel