C# Remove last specific character in a string

In this C# program, we will see how to Remove last specific character in a string. In this example we will remove last , from the string.

C# Remove last specific character in a string Code:

 private static void Main(string[] args)
        {
            string input = "1,2,3,14,16,18,20,";
            Console.WriteLine("Input: " + input);
            Console.WriteLine("Output: " + input.TrimEnd(','));

            Console.ReadLine();
        }

C# Remove last specific character in a string Output:

CSharp-Remove-last-specific-character-in-a-string

 
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
7 + 2 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice