该方法返回一个布尔值,以确定一个字符串是否等于另一个字符串。如果字符串相等,则将返回true值,否则将返回false值。
equal(str1,str2)
str1,str2 −需要比较的2个字符串。
如果两个字符串相等,则将返回true值,否则将返回false值。
-module(helloworld).
-import(string,[equal/2]).
-export([start/0]).
start() ->
Str1 = "This is a string1",
Str2 = "This is a string2",
Status = equal(Str1,Str2),
io:fwrite("~p~n",[Status]).
当我们运行上面的程序时,我们将得到以下结果。
false