|
SOLUTIONS
|
MATHEMATICA 内置符号
StringReplaceList
StringReplaceList["string", s->sp] 或 StringReplaceList["string", {s1->sp1, s2->sp2, ...}]
给出列表,将
中匹配的子串替换为
.
StringReplaceList["string", srules, n]
给出前 n 个符合条件的子串.
StringReplaceList[{s1, s2, ...}, srules]
给出所有符合条件的子串
.
更多信息更多信息
可以为 StringExpression 中任何对象.- StringReplaceList 仅替换一个子串.
- StringReplaceList 遍历整个字符串,依次检验每个子字符串. 对每一个子字符串,试图运用每个指定的转换规则,返回应用后的结果.
- StringReplaceList 在多路系统中单步执行.
- 若
在
替换中不计算字符串,StringReplaceList 会产生一个 StringExpression 而不是普通字符串. - 在如
替换中,
只有在使用时才计算. - 设置选项为 IgnoreCase->True 使 StringReplaceList 不区分大小写.
版本 5.1 的新功能
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
