How to remove all white space from the beginning or end of a string?
问题 How can I remove all white space from the beginning and end of a string? Like so: \"hello\" returns \"hello\" \"hello \" returns \"hello\" \" hello \" returns \"hello\" \" hello world \" returns \"hello world\" 回答1: String.Trim() returns a string which equals the input string with all white-spaces trimmed from start and end: " A String ".Trim() -> "A String" String.TrimStart() returns a string with white-spaces trimmed from the start: " A String ".TrimStart() -> "A String " String.TrimEnd()