What does this code do?
txtCardNo.Text.Trim().Substring((txtCardNo.Text.Trim().Length - 4), 4)
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.
It gets last 4 characters from
txtCardNo(without leading or ending spaces) but it would be better if it was like this:EDIT:
Also, note that this will throw error if trimmed string has less than 4 characters. You could handle it with something like this: