Does swift have a trim method on String?

Posted by Rohit Kumar | Updated on

In this answer, I have shared does swift have a trim method on string in Swift? Here’s how you remove all the whitespace from the beginning and end of a String.

Example tested with Swift 3+.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers