I've got a problem with removing whitespaces at the beginning and end of string. For e.g. I've got a string like:
\r\n\t- Someone will come here?\n- I don't know for sure...\r\n\r\n
And I need to remove whitespaces only at the end and beginning (string should be look like:
- Someone will come here?\n- I don't know for sure...
Also there could be a lot of variants of string end: "\r\n\r\n", "\r\n", "\n\r\n" and so on...
Thanks.
You can use this extension and just call "yourString".trim()
In Swift 4 Use it on any String type variable.
And Call it like this