Convert a Go string to a rune slice using the built-in []rune() conversion to handle Unicode characters correctly.
Use the built-in []rune() conversion to transform a string into a slice of runes, which correctly handles multi-byte Unicode characters.
s := "hello"
r := []rune(s)
This creates a new slice where each element is a Unicode code point, allowing you to safely manipulate individual characters regardless of their byte length.
In Go, a string is a sequence of bytes, but a rune is a single Unicode character. Converting a string to a rune slice breaks the text into individual characters, handling complex symbols like emojis or accented letters correctly. Think of it as turning a solid block of text into a list of individual letters you can count or change one by one.