Erlang - len 方法
该方法返回特定字符串的长度
语法
len(str)
参数
str − 这是需要确定字符数的字符串。
返回值
返回值是字符串中的字符数。
例如
-module(helloworld). -import(string,[len/1]). -export([start/0]). start() -> Str1 = "This is a string1", Len1 = len(Str1), io:fwrite("~p~n",[Len1]).
输出
当我们运行上面的程序时,我们将得到以下结果。
17