swift get remove character from string code example Example: swift remove space from string let freedSpaceString = str.filter {!$0.isWhitespace}