Skip to main content
  1. Sipping Go/

Strings concatenation in Golang (merge strings)

·1 min

In Golang, string are in Go, concatenating strings is fairly easy and straight forward, you simply use the add or addition symbol and you are all set. and here is an example

func concatenate() {
    firstName := "Mohamed"
    lastName := "Allam"
    fullName := firstName + lastName
    fmt.Println(fullName)
}

Or you can try it yourself

Strings are arrays, so you can use indexing as well,

firstName := "Mohamed"
firstLetter := firstName[0] // returns M
lnFirstLetter := "Allam"[0] // return A