📅  最后修改于: 2022-03-11 14:49:13.454000             🧑  作者: Mango
using System.Linq;
// ...
string example = " Hi there! ";
string trimmed = String.Concat(example.Where(c => !Char.IsWhiteSpace(c)));
// Result: "Hithere!"