Erlang - equal 方法
该方法返回一个布尔值,判断一个字符串是否与另一个字符串相等。 如果字符串相等,则返回 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