package main
import (
"fmt"
"strings"
)
func testSplit() {
ips := "10.108.34.30;10.108.34.31"
ipArray := strings.Split(ips,";") //以字符串里的;号为条件进行分割
fmt.Printf("first ip:%s\n",ipArray[0])
fmt.Printf("last ip:%s\n",ipArray[1])
}
func main() {
testSplit()
}
输出:
first ip:10.108.34.30
last ip:10.108.34.31