How to use multiple replacements on a string in one line with C#

1 Answer

0 votes
using System;

class Program
{
    static void Main()
    {
        String s = "bbb";
      	
		s = s.Replace("b", "x").Replace("x", "y").Replace("y", "z");
   
        Console.WriteLine(s);
    }
}


/*
rum:

zzz

*/

 



answered Jun 18, 2019 by avibootz

Related questions

1 answer 192 views
2 answers 206 views
1 answer 198 views
1 answer 181 views
3 answers 309 views
...