I have the following code:
string foo = "blah".PadLeft(4, ' ');
But when I check it, instead of foo being "____blah" (with 4 spaces at the start), it’s just "blah". Why doesn’t PadLeft do what I expect?
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.
Because the first argument is total length of resulting string and not number of character to pad. So in your example you want to use 8 instead of 4.