所以基本上我想要deletetxt 文件中的字符串。
using fs
输入示例:
string1
string2
string3
string4
Delete string3
删除后会是这样的:
string1
string2
string4
读取文本文件获取变量中的内容然后使用字符串替换 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
例如
var stringContent="Here goes the content of the textFile after read"
var res=stringContent.replace('string3','');
//write back res to the file or do what ever
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)