How to check if a variable contains a value? Cant use if_v2 after update for Firefox (ver.9), also cant use if + .contains or .includes

Actually, I spoke to soon! Your sample macro also fails in Chrome. The correct way to check if a string includes another string is this method and it works fine:

{
  "Name": "stringcheck",
  "CreationDate": "2024-5-2",
  "Commands": [
    {
      "Command": "store",
      "Target": "test tim meyer",
      "Value": "e",
      "Description": ""
    },
    {
      "Command": "if",
      "Target": "${e}.lastIndexOf(\"tim\") > -1",
      "Value": "",
      "Description": "the return value of .lastIndexOf() is -1 if the substring is not found in the string at all."
    },
    {
      "Command": "echo",
      "Target": "yes, it contains this string",
      "Value": "blue",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}
1 Like