Created
November 17, 2015 12:35
-
-
Save fitomad/68e2a343cb5e592b9639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CollectionType | |
{ | |
/** | |
Construye una cadena de texto con los elementos contenidos | |
- parameter separator: Un caracter que se emplea para separar los elementos | |
*/ | |
func descriptionWithSeparator(separator: String) -> String | |
{ | |
return self.reduce(String()) | |
{ | |
if String($0).isEmpty | |
{ | |
return String($1) | |
} | |
else | |
{ | |
return "\(String($0))\(separator)\(String($1))" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment