Change string
package main
import (
"fmt"
)
func main() {
text := "Hello World!"
fmt.Println(text)
// text[5] = "Y" // cannot assign to text[5]
text = text[:5] + "-" + text[6:]
fmt.Println(text)
}
Hello World!
Hello-World!
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import (
"fmt"
)
func main() {
text := "Hello World!"
fmt.Println(text)
// text[5] = "Y" // cannot assign to text[5]
text = text[:5] + "-" + text[6:]
fmt.Println(text)
}
Hello World!
Hello-World!