String Trim() Method in C#



String Trim() Method in C#

Trim() – The C# Trim() method is used to remove extra whitespace from beginning and ending of string.

C# Example of Trim()

meeraacademy.com
String Trim() Example in C#

In above Trim() method example we input value ”   meera     ” in textbox. The output value is “meera” after applying Trim() function on given string the whitespace removed from beginning and ending of the string.

C# code for Trim() button click :

protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text.Trim();
}

Related ASP.Net Topics :

Nested If Statement in C#.Net
Switch Statement in C#.Net


Subscribe us

If you liked this c#.net post, then please subscribe to our YouTube Channel for more c#.net video tutorials.

We hope that this C#.net tutorial helped you to understand String Trim() method.


Next asp.net tutorial we will learn about If-Else If-Else Statement.


Leave a Reply

Your email address will not be published. Required fields are marked *