Introducing Radical.sh

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

TrimStart in C#

Using TrimStart function, we can trim the spaces only at starting place of the string.

  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 s1 = " Forget code ";
  12.  
  13. string s2 = s1.TrimStart();
  14.  
  15. // ! is added here to see the space present or not
  16.  
  17. Console.WriteLine("!" + s2 + "!");
  18.  
  19. }
  20. }
  21. }


Output:
!Forget code !


..