Answers for "golang string split"

Go
4

golang string split

s := strings.Split("a,b,c", ",")
Posted by: Guest on August-20-2020
1

golang split spaces

someString := "one    two   three four "

words := strings.Fields(someString)

fmt.Println(words, len(words)) // [one two three four] 4
Posted by: Guest on August-13-2020
1

golang find in string

// 1. Contains
res := strings.Contains(str, substr)
fmt.Println(res) // true
Posted by: Guest on August-20-2020

Browse Popular Code Answers by Language