erlang中命令行传参,以及类型等。

参考:1.http://www.cnblogs.com/me-sa/archive/2012/03/20/erlang0047.html

   2.http://www.erlang.org/doc/reference_manual/data_types.html 

erlang中类型的转换,原因是在看编译并运行程序一章时,考虑到命令行给erl传值时的不识别问题。
a)命令行通过如下形式传参
$-s M F A
A传入的是一个参数列表,即若调用:$ -s M F 4 5 形式时,传入参数列表为['4', '5'],并且注意这里列表的元素是原子,在使用时不能直接应用其字面值。而需要将对应参数用atom_to_list(),然后再用list_to_integer()函数来得到字面数值。
注意:
integer_to_list(Integer, Base) -> string()

Types:

Integer = integer()
Base = 2..36
Returns a string which corresponds to the text representation of Integer in base Base.

list_to_integer(String, Base) -> integer()

Types:

String = string()
Base = 2..36
Returns an integer whose text representation in base Base is String.

转载于:https://www.cnblogs.com/moniza/p/3896375.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值