How to trim leading and trailing specific character from a string in C#

1 Answer

0 votes
using System;
 
class Program
{
    static void Main() {
        string s = "!!!!!!c# c++ c java!!!";
        
        char CH = '!';
 
        s = s.Trim(CH);
         
        Console.Write(s);
    }
}
 
 
 
 
/*
run:
 
c# c++ c java
 
*/

 



answered Jul 11, 2020 by avibootz

Related questions

1 answer 144 views
1 answer 174 views
1 answer 157 views
3 answers 363 views
1 answer 138 views
...