Add Zeroes to a string

Hi,

How do i check if a string has less than 8 characters in C# and if it has, fill it to 8 characters with zeroes

if

eg:

input: 99
output: 00000099

jedistarAsked:
Who is Participating?
 
icrConnect With a Mentor Commented:
string numberString = "99";
numberString = numberString.PadLeft(8, '0');
0
 
SystemExpertConnect With a Mentor Commented:
int large = 99;
label1.Text =(large.ToString("00000000")); //output: 00000099
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.