该方法返回字符串中字符的索引位置。
str(str1,chr1)
str1 - 这是需要搜索的字符串。
Chr1 - 这是需要在字符串中搜索的字符。
返回字符串中字符的索引位置。
-module(helloLearnfk). -import(string,[chr/2]). -export([start/0]). start() -> Str1="hello Learnfk", Index1=chr(Str1,$e), io:fwrite("~p~n",[Index1]).
当我们运行上述程序时,我们将得到以下输出。
链接:https://www.learnfk.comhttps://www.learnfk.com/erlang/erlang-chr.html
来源:LearnFk无涯教程网
2
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Python实战 · 从0到1搭建直播视频平台 -〔Barry〕