join操作:strings.Join(a[]string,sep string)
package main
import (
"fmt"
"strings"
)
func testJoin() {
var strArr []string = []string{"10.237.8.2","10.237.8.3","10.237.8.4"}
resultStr := strings.Join(strArr,";")
fmt.Printf("resultStr = %s\n",resultStr)
}
func main() {
testJoin()
}
输出:
resultStr = 10.237.8.2;10.237.8.3;10.237.8.4