trimmingCharacters(in:)
Returns a new string made by removing from both ends of the receiver characters contained in a given character set.
Declaration
func trimmingCharacters(in set: CharacterSet) -> StringParameters
- set:
A character set containing the characters to remove from the receiver.
setmust not benil.
Return Value
A new string made by removing from both ends of the receiver characters contained in set. If the receiver is composed entirely of characters from set, the empty string is returned.
Discussion
Use whitespaces or whitespacesAndNewlines to remove whitespace around strings.