Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Replace a string in a string in C#

We can replace a string that is there in another string as below:

  1. using System;
  2. using System.IO;
  3. using System.Text;
  4.  
  5. namespace forgetCode
  6. {
  7. class program1
  8. {
  9. static void Main(string[] args)
  10. {
  11. string baseString = "Forget code";
  12.  
  13. string newString = baseString.Replace("get","getting");
  14.  
  15. Console.WriteLine(newString);
  16.  
  17. }
  18. }
  19. }


Output:
Forgetting code

..