如何将字符串转换为字符串数组

I am trying to convert a string ["211007@it_4","211008@it_4"], which is saved in MySQL database to an array of string to use it as an index value.

I can not find a good way to do this in Go.

Your input looks like a JSON array with string elements. If that is so, simply use the encoding/json package to unmarshal it into a []string variable.

Example:

s := `["211007@it_4","211008@it_4"]`
var parts []string
if err := json.Unmarshal([]byte(s), &parts); err != nil {
    fmt.Println(err)
}
fmt.Println("elements:", parts)

Output (try it on the Go Playground):

elements: [211007@it_4 211008@it_4]

The standard library contains functions to work with strings (e.g. strings.Trim() and strings.Split()).

See the code - https://play.golang.org/p/vOAzyU4eZbf