I need to generate string value in form "000x" (it will be inserted into database). I get the value (x-1) from database, so the starting values of number x and string are 1 and "0001". If last string in database is for example "0007", the x value is 8 and next string to be inserted is "0008". Number of zeros before x depends on whether x is single digit, two digit, three digit or four digit number (let put constraint on x max value to 9999).
"0009" "0099" "0999" "9999"
How can I get output string "000x" for input number x (taking care about number of zeros in front of x)?