反正有没有做这样的工作......
for (j=0;j<arrayone.length;j++){
str1 = str1.replace(arrayone[j],arraytwo[j]);
}
这当然就像一个不起作用的伪代码......但是有没有办法做这样的事情?
注意:str1 one 是常规页面文本,数组中包含某些单词。将字符串拆分为数组有帮助吗?
str1=str1.split(" ");
str1 is regular text.
arrayone == [one, two, three]
arraytwo == [this, that, other]
因此,如果您"one"
在文本页面上找到...将其替换为"this"