Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active August 8, 2019 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/0c6afe1e3f571dd6c6f2b41ea06b9911 to your computer and use it in GitHub Desktop.
Save parzibyte/0c6afe1e3f571dd6c6f2b41ea06b9911 to your computer and use it in GitHub Desktop.
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