Retrieving a string containing the substring


I want to retrieve the string containg a substring:

I have the following code:

const contractPath = path.resolve(‘/home/zulfi/Truffle_programs/search_opcode/’,‘contracts’,files[i]);
const contractCode2 = fs.readFileSync(contractPath, “utf8”);
const complete_string = (“selfdestruct”) >= 0 ? true : false);
console.log(‘selfdestruct exists:’, selfdestructExists2);

The above code is storing true or false value in complete_string. How can I store the complete string containing the substring “selfdestruct” in the variable complete_string?

Somebody please guide me.



You can just return the complete string instead of true.

const complete_string = ("selfdestruct") >= 0 ? contractCode2 : false);
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.