Language
Version: 5
Categories
-
User Program Communication
-
Variables
-
Control Flow
-
Object Oriented Programming
-
Strings
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!"