Post

GoLangGoLang

A
Athiq mohd

Posted on 28th January 2023|16 views

0
votes

Golang String Concatenation

How can I concatenate two strings in Golang?

Answers
P
sumana reddy

Posted on 28th January 2023

Use += operator to do so, try this example

package main

import "fmt"

func main() {

  1str := "Welcome"

    2str := "mindmajix"

 1str += 2str

    fmt.Println("String: ", 1str)

  1str += "This is to concatinate two strings"

    fmt.Println("String: ", 1str)

 2str += "Portal"

    fmt.Println("String: ", 2str)}

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos