【发布时间】:2011-04-13 10:41:54
【问题描述】:
以下 shell 会话显示了我想了解的一些行为:
1> A = "Some text".
"Some text"
2> "Some " ++ R = A.
"Some text"
3> R.
"text"
4> B = "Some ".
"Some "
5> B ++ L = A.
* 1: illegal pattern
肯定语句 2 和 5 在语法上是相同的吗?我想使用这个习惯用法从字符串中提取一些文本,其中B 是从配置文件中读取的。这可能吗?我应该使用什么语法来代替上面 5) 中显示的语法?
谢谢!
【问题讨论】:
标签: string erlang pattern-matching design-patterns