Predeclared type

Go string type

Immutable sequence of bytes; may contain invalid UTF-8. Indexing returns a byte and len reports bytes, not runes or graphemes. Its zero value is the empty string. Example output: '8'.

Formal Syntax & Structure

go syntaxgo
string

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  var s string = "سلام"  fmt.Println(len(s))}
Go Reference