C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String Trim()The C# Trim() method is used to remove all leading and trailing white-space characters from the current String object. Signaturepublic string Trim() public string Trim(params Char[]) ParameterFirst method does not take any parameter. Second method takes a char array as parameter. ReturnIt returns a string. C# String Trim() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s1 = "Hello C#"; string s2 = s1.Trim(); Console.WriteLine(s2); } } Output: Hello C#
Next TopicC# String TrimEnd()
|