Avatar ·

Extracting substring in Go: how to get part of a string by indices?

Hi! I just started learning Go and encountered a problem when working with strings. In other languages (like Python or JavaScript), I'm used to doing something like `str[1:4]` to get a substring. In Go, I tried a similar syntax but got something unexpected. Here's my code: ```go package main import "fmt" func main() { str := "Привет, мир!" sub := str[1:4] fmt.Println(sub) // Expected: "рив", but getting something strange } ``` Instead of "рив", I see some broken characters. I read that Go uses UTF-8, but I don't understand how this affects substring extraction. I also tried working with an ASCII string: ```go str := "Hello, World!" sub := str[1:4] fmt.Println(sub) // Outputs "ell" — this works! ``` Why do problems arise with Cyrillic? How to p