Strings

String Trim in C#

Trim removes all the leading and trailing white-space characters from a string.


Syntax
string trimmedString = stringName.Trim();

Notes


Example
string untrimmed = "Welcome to SyntaxCenter!   ";
string trimmed = untrimmed.Trim();
Console.WriteLine(trimmed); //should output "Welcome to SyntaxCenter!"

See Also
Documentation

System.Trim Method - MSDN

Add to Slack

< String Compare   |   String Split >

© 2018 SyntaxDB. All Rights Reserved.