I have splited the resulted text of a file, what I need to do is to rename the header of that file, so I have taken the first indice of the sp (the header) and for each word in this header, I want to replace them with a different random string. But I have the same random string for each satisfied regex.
var sp = reader.result.split("\n");
var randomString = Math.random().toString(36).substr(5, 5)
for ( let i in sp ){
if (i == 0) {
sp[i] = sp[i].replace(regex, randomString)
}
}
Aucun commentaire:
Enregistrer un commentaire