How to remove all occurrences of a character in a string with C#

2 Answers

0 votes
using System; 
  
class Test 
{ 
    public static void Main() 
    { 
        string s = "c# programming version 7.3";
        
        if (s.Contains("g")) {
            s = s.Replace("g", "");
        }
        
        Console.Write(s); 
    }  
}


/*
run:

c# prorammin version 7.3

*/

 



answered Feb 2, 2019 by avibootz
0 votes
using System; 
  
class Test 
{ 
    public static void Main() 
    { 
        string s = "c# programming version 7.3";
        
        s = s.Replace("o", "");

        Console.Write(s); 
    }  
}


/*
run:

c# prgramming versin 7.3

*/

 



answered Feb 2, 2019 by avibootz

Related questions

1 answer 149 views
1 answer 109 views
1 answer 87 views
1 answer 170 views
1 answer 187 views
...