C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
And: We create a new string from the modified rune slice. This is character-based string manipulation in Go.
Golang program that modifies runes from string
package main
import "fmt"
func main() {
original := "cat"
fmt.Println(original)
// Get rune slice.
// ... Modify the slice's data.
r := []rune(original)
r[0] = 'm';
r = append(r, 'e')
// Create new string from modified slice.
result := string(r)
fmt.Println(result)
}
Output
cat
mate