golang字符串去除空格和换行符
package main import ( "fmt" "strings" ) func main() { str := "welcome to cn\nbattle\n.com" // 去除空格 str = strings.Replace(str, " ", "", -1) // 去除换行符 str = strings.Replace(str, "\n", "", -1) fmt.Println(str) }……
Golang、PHP、移动互联网、项目管理、软件架构