join操作:strings.Join(a[]string,sep string)

    1. package main
    2. import (
    3. "fmt"
    4. "strings"
    5. )
    6. func testJoin() {
    7. var strArr []string = []string{"10.237.8.2","10.237.8.3","10.237.8.4"}
    8. resultStr := strings.Join(strArr,";")
    9. fmt.Printf("resultStr = %s\n",resultStr)
    10. }
    11. func main() {
    12. testJoin()
    13. }

    输出:

    1. resultStr = 10.237.8.2;10.237.8.3;10.237.8.4