how to remove special characters at the beginning/end of a string in swift 4
For example,
let myString = "abcde."
IF I want to remove special characters from the end of myString like .
then it returns to me abcde
OR, if I want to remove e.
at the end, it will return abcd
.
AND, if I put something wrong like de
, it will return the original string abcde.
Removing special characters at the beginning is the similar situation.