GO語言"strings"包中"Join"函數的用法及代碼示例。
用法:
func Join(elems []string, sep string) string
Join 連接其第一個參數的元素以創建單個字符串。分隔符字符串 sep 放置在結果字符串中的元素之間。
例子:
package main
import (
"fmt"
"strings"
)
func main() {
s := []string{"foo", "bar", "baz"}
fmt.Println(strings.Join(s, ", "))
}
輸出:
foo, bar, baz
相關用法
- GO Join用法及代碼示例
- GO PutUvarint用法及代碼示例
- GO Scanner.Scan用法及代碼示例
- GO LeadingZeros32用法及代碼示例
- GO NewFromFiles用法及代碼示例
- GO Regexp.FindString用法及代碼示例
- GO Time.Sub用法及代碼示例
- GO Regexp.FindAllIndex用法及代碼示例
- GO Encode用法及代碼示例
- GO ResponseRecorder用法及代碼示例
- GO Value用法及代碼示例
- GO StreamWriter用法及代碼示例
- GO Fscanln用法及代碼示例
- GO Values.Get用法及代碼示例
- GO NumError用法及代碼示例
- GO TrailingZeros8用法及代碼示例
- GO Logger.Output用法及代碼示例
- GO Float.SetString用法及代碼示例
- GO NewReader用法及代碼示例
- GO Tx.ExecContext用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 Join。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。