Link to home
Start Free TrialLog in
Avatar of Lorna70

asked on

How do I remove spaces before and after a username entered into a text box?

Hi I'm developing a website where I allow users to enter a username which could have spaces e.g 'Joe Blogs' - how do I remove any spaces accidentally added before or after this name e.g '   Joe Blogs    '??  I search against this sometimes in my site so I don't want to miss this user name just because I'm searching for 'Joe Blogs' when it has actually been entered in as '  Joe Blogs   '.  I'm programming in c#.  So basically I think it's better to remove them before they are entered into the database (in the code behind - not Javascript!!).
Avatar of Om Prakash
Om Prakash
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial