I need to have a string, based on an integer, which should always have 5 digits.
Example:
myInteger = 999 formatedInteger = '00999'
What is the best way of doing this in classic ASP?
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 string manipulation functions for this.
This assumes classic ASP with VBScript (original version of the answer).
Here an optimized version, wrapped in a function, offering variable width padding: