string trim function is used in C# code example Example: c# trim string string hello = " hello world "; hello.Trim();