I need to get a code where it should be of 7 numbers, if it is less than 7 then it should insert 0 at the start:
eg:
if(i=7)
1000001
i>7
A1234 --> 00A1234
How can i get output..?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Feb 16, 2014, 11:20 PM EST
VulpesRank #55 · 29.2K reputationPosted Feb 17, 2014, 1:31 AM EST
Alternatively, if you're starting with hex numbers and want to convert them to hex strings which are 7 characters long, you can use the ToString() method with the "X7" format specifier:
Shweta LodhaRank #31 · 39.8K reputationPosted Feb 17, 2014, 10:51 AM EST