String: trim : String Pad Trim « String « C# / CSharp Tutorial






using System;  
  
class MainClass {  
  public static void Main() {  
    string str = "     test    "; 
 
    Console.WriteLine("Original string:" + str+"<"); 
     
    // Trim spaces. 
    str = str.Trim(); 
    Console.WriteLine("|" + str + "|"); 
 
  } 
}
Original string:     test    <
|test|








5.16.String Pad Trim
5.16.1.String PadLeft and PadRight
5.16.2.String: trim
5.16.3.String: PadLeft/Right with character
5.16.4.String: Pad on right with #s
5.16.5.String: Trim #s
5.16.6.Trimming a string: trim start, trim end and trim chars