Erlang-equal

提供:Dev Guides
移動先:案内検索

アーラン-等しい

このメソッドは、ある文字列が別の文字列と等しいかどうかのブール値を返します。 文字列が等しい場合、trueの値を返します。それ以外の場合、falseの値を返します。

構文

equal(str1,str2)

パラメーター

  • str1、str2 -比較する必要がある2つの文字列。

戻り値

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