Archive

Posts Tagged ‘list’

String concatenation

February 25th, 2009

As we all know, Erlang treats String as the array of integers, hence operations on list are applicable on String. 

String concatenation can be done in different ways in Erlang

1> X="I love ".
"I love "
2> Y="Erlang".
"Erlang"
3> string:concat(X, Y).
"I love Erlang"
4> string:join([X, Y], "").
"I love Erlang"
5> X ++ Y.
"I love Erlang"
6> lists:append(X, Y).
"I love Erlang"
7> lists:concat([X, Y]).
"I love Erlang"

Basic ,