Should I use textbox.text.Trim() function every time when I insert any data from web page to database.
I just have a habit of using the trim function? Does it effect the performance any way? Should I use everytime or just when needed?
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.
I’ve seen many problems with spaces which had been added at the end to a text field by accident (for instance logins which mysteriously didn’t work). So it’s not a bad idea at all to trim() most textfield input as a standard practice.
I think the performance hit of a trim() is absolutely neglible, except maybe for sites with ultra high traffic.