Skip to content Skip to sidebar Skip to footer

Ignore Whitespace In Textfield

I have a text field on my web app. In this field is a url address that user can specify. If a user sets an incorrect url address that is prefixed with a space, ' www.blablabla.xyz

Solution 1:

Try the following, which will help you to find white space in your string and replace it with non white space.

      yourString.Replace(" ","");

Solution 2:

Try this one,

    yourString.TrimStart(string.WhiteSpace);

Post a Comment for "Ignore Whitespace In Textfield"