Contains string function not working


#1

1) Give a description of the problem
I am trying to match a string returned by my Ecobee thermostat that contains the word “away” but the contains string function is always returning “false”

2) What is the expected behavior?
the contains string function should return true and match the if condition to set the testing string variable

3) What is happening/not happening?
The evaluation of contains is returning false when it should return true.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)

And below I ran the function in the evaluation console and same results:

image


#2

I thought it was contains(string,substring)?


#3

@eibyer is correct. you are using the function backwards:

Syntax
boolean contains(string haystack, string needle)`

Returns
Returns true if the  `needle`  is found anywhere in the  `haystack`

#4

Oh I am so dumb…yes it was backwards…