github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume1/section2/stringbasics/stringbasics.go (about)

     1  // String examples covering declaration, literal definition, accessing character at value
     2  // and concatenating strings using the + operator.
     3  package main
     4  
     5  import "fmt"
     6  
     7  func main() {
     8  
     9  	var subject string = "Gopher"
    10  
    11  	fmt.Println("First element of Gopher string: ", string("Gopher"[0]))
    12  	fmt.Printf("The first value of the subject string: %v\n", string(subject[0]))
    13  	fmt.Printf("The last value of the subject string: %v\n", string(subject[len(subject)-1]))
    14  	fmt.Println("Hello " + subject + "!")
    15  
    16  }