find and solve || findandsolve.com
Please wait.....

C# String TrimEnd()

In the c# String TrimEnd() method is used to remove the occurrences of a set of characters specified in an array from the ending of the current String object that are in the trimChars parameter.

Syntax

public string TrimEnd(params Char[] ch)  

Parameter

ch: It takes a char array as parameter.

Return

It returns a string.


C# String TrimEnd() Method Example

using System;
public class Program
{
  public static void Main()
    {
         string str = "Hello FindAndSolve";
         char[] ch = {'e'};
         string str1= str.TrimEnd(ch);
         Console.WriteLine(str1);
    }
}

Output

Hello FindAndSolv