Introducing Radical.sh

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

Remove a string in a string in C#

We can remove a substring in a string by specifying "After position" and "No of characters".

  1. Syntax: Remove(After position,No of characters)


  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.Remove(3,5);
  14.  
  15. Console.WriteLine(newString);
  16.  
  17. }
  18. }
  19. }


Output:
Forode

..