golang( strings 详细 )--更新

本篇内容是关于 go strings 包内容的详解,逐步更新中

 

 1 package main
 2 
 3 import (
 4     "fmt"
 5     "strings"
 6 )
 7 
 8 func main() {
 9 
10     // Join 将数组变为字符串,php:implode
11     s1 := []string{"foo", "bar", "baz"}
12     fmt.Println(strings.Join(s1, ", "))
13  
14     // Fields 将字符串变为数组   [a,b,c]
15     s2 := "a,b,c"
16     fmt.Println(strings.Fields(s2))
17 }

 

转载于:https://www.cnblogs.com/SkeyJIA/p/6394182.html

你可能感兴趣的:(golang( strings 详细 )--更新)