Comparing Strings #1680
Unanswered
williamoc74
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Sorry. I don’t quite understand the problem you are trying to solve. Strings aren’t special in ethers… Do you need quotes around your |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi..
I'm trying to compare strings while using ethers. I've tried lots of different ways and I'm just not getting it, I know it's very basic but hopefully someone here can help me. :)
I'm taking data from transaction.data and calling it string 'ourData' . I'm converting it to a string 74 in length and calling it string 'ourNewData' . If 'ourNewData' is the same as 'inputData' (a string that I populate with my own data) I want my function foo() to run, if not, I want it to keep checking until it does match.
It just keeps running through the if statement as if it does match all the time.
I've tried different ways of storing the strings and checking them ,(===), booleens etc but nothing is working. I see alot of stuff about == vs === in javascript but whatever way I try it just won't do what I want.
This is the code..
<const init = function ()
{
const provider = new ethers.providers.WebSocketProvider(url);
provider.on("pending", (tx) =>
{
provider.getTransaction(tx).then(function (transaction)
{
const ourData = transaction.data;
}
}>
Thanks..
Beta Was this translation helpful? Give feedback.
All reactions