concat
该方法连接2个字符串并返回连接的字符串。
语法 (Syntax)
concat(str1,str2)
参数 (Parameters)
str1,str2 - 需要连接的2个字符串。
返回值 (Return Value)
返回2个字符串的串联。
例如 (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)
当我们运行上述程序时,我们将得到以下结果。
“This is a string”