Erlang – concat

Erlang concat

In this guide, we will discuss concat in Erlang. The method concats 2 strings and returns the concatenated string.

Syntax

concat(str1,str2)

Parameters

  • str1,str2 − The 2 strings which need to concatenated.

Return Value

Returns the concatenation of the 2 strings.

For example

-module(helloworld). 
-import(string,[concat/2]). 
-export([start/0]). 

start() -> 
   Str1 = "This is a ", 
   Str2 = "string", 
   Str3 = concat(Str1,Str2), 
   io:fwrite("~p~n",[Str3]).

Output

When we run the above program, we will get the following result.

“This is a string”

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply