【发布时间】:2018-05-27 22:39:03
【问题描述】:
R 有一个强大的字符串处理包stringi。特别是,我想实现与 stri_replace_all_fixed 函数相同的功能:在 Perl/PHP/Python 或 C# 中根据列表/字典替换匹配项。
#install.packages("stringi")
library(stringi)
stri_replace_all_fixed("The quick brown fox jumped over the lazy dog.",
c("quick", "brown", "fox"), c("slow", "black", "bear"), vectorize_all=FALSE)
输出:
“慢吞吞的黑熊跳过了懒狗。”
【问题讨论】:
-
你的例子中的输出是什么?
-
@afc11hn 好点,我在输出中添加了更详细的 R 示例。
标签: c# python regex string perl