string
package main
import (
"fmt"
)
func main() {
//single string definition
var str1 string = "hello1"
var str2 = "hello2"
str3 := "hello3"
str4 := str1 + str2 //concat
str4 += "anoter string" ////concat
//loop
for k, v := range str1 {
}
//loop
for k, v := range []rune(str1) {
}
//[]string
var strs []string
strs = append(strs, "hello")
strs = append(strs, "world")
fmt.Println(strs) //[hello world]
var strs1 = []string{"hello", "i love you"}
fmt.Println(strs1) //[hello i love you]
strs2 := make([]string, 0)
strs2 = append(strs2, "hello")
strs2 = append(strs2, "world")
fmt.Println(strs2) //[hello world]
}