Padding to get specific number of digits in a number

Viewed 9312
String val = "98"

I need to get the output as 0000098 (7 digits).

I need left padding of zeros to the string or integer value...

The number stored in val is dynamic and may contain any number of digits, but the output should always be 7 digits.

4 Answers
Related