Instantly share code, notes, and snippets.

@fitomad /array_join.swift Secret
Last active Nov 19, 2018

Embed
What would you like to do?
let todosLosPersonajesJuntos = personajes.joined()
print(todosLosPersonajesJuntos)
// PennyLeonardSheldonRajHoward
let todosLosPersonajesJuntosConSeparador = personajes.joined(separator: ", ")
print(todosLosPersonajesJuntosConSeparador)
// Penny, Leonard, Sheldon, Raj, Howard
let dosArrays = personajes.split(separator: "Leonard")
print(dosArrays)
// [
// ArraySlice(["Penny"])
// ArraySlice(["Sheldon", "Raj", "Howard"])
// ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment