golang中字符串操做strings.ToUpperhtml
package main import ( "fmt" "strings" ) //golang字符串操做 func main(){ s := "hello world hello world" //str := "wo" //var s = []string{"11","22","33"} //將s中的全部字符修改成其大寫格式。對於非ASCII字符,它的大寫格式須要查錶轉換 ret := strings.ToUpper(s) fmt.Println(ret) //HELLO WORLD HELLO WORLD }