Answers for "go string array to array"

Go
0

golang string to array

toArray := strings.Split("you must be pray before learn anything", " ")
fmt.Printf("this is array %v and type data is %v", toArray, reflect.TypeOf(toArray))
Posted by: Guest on October-04-2021
-1

string array to string golang

str1 := []string{"the","cat","in","the","hat"}
fmt.Println(str1)
 
str2 := strings.Join(str1, " ")
fmt.Println(str2)
 
str3 := strings.Join(str1, ", ")
fmt.Println(str3)
 
Output:
[the cat in the hat]
the cat in the hat
the, cat, in, the, hat
Posted by: Guest on November-05-2021

Browse Popular Code Answers by Language