Trim End - CSharp System

CSharp examples for System:String Strip

Description

Trim End

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Net;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using System;/*from  w w  w.  j a va  2  s .com*/

public class Main{
        public static string TrimEnd(this string input, string trimString)
        {
            var result = input;
            while (result.EndsWith(trimString))
                result = result.Substring(0, result.Length - trimString.Length);
            return result;
        }
}

Related Tutorials