Last active
August 8, 2019 22:35
-
-
Save parzibyte/0c6afe1e3f571dd6c6f2b41ea06b9911 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
package main | |
/* | |
Separar una cadena usando un delimitador | |
en Go; a través de la función Split | |
https://parzibyte.me/blog | |
*/ | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
nombres := "Luis,María José,Fernando,John Galt" | |
delimitador := "," | |
nombresComoArreglo := strings.Split(nombres, delimitador) | |
for _, nombre := range nombresComoArreglo { | |
fmt.Println(nombre) | |
} | |
} | |
/* | |
Salida: | |
Luis | |
María José | |
Fernando | |
John Galt | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment