How do I use the ToString method on an integer to display a 2-char
int i = 1; i.ToString() -> "01" instead of "1"
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
i.ToString("D2")ori.ToString("00")See Standard Numeric Format Strings and Custom Numeric Format Strings on Microsoft Docs for more details