Post

GoLangGoLang

A
Athiq mohd

Posted on 25th April 2024|41 views

0
votes

Golang String Concatenation

How can I concatenate two strings in Golang?

Answers
P
sumana reddy

Posted on 25th April 2024

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