Looking to add a function of my labeling expression to not label feature with the word 'TO". For example, some roads are named '5th TO I-10'. I am using Python as the parser with advanced checked.
Here is what I have so far. The split function is working as intended.
def FindLabel ([SFEANME]):
word = 'TO'
if word in [SFEANME]
return Null
else
return [SFEANME].split(" ")[0]
[SFEANME] is the field for the feature name and is text type.
Here is the error I get when verifying: "The expression contains an error. Modify the expression and try again. Error 0 on line 0. SyntaxError: invalid syntax (, line 3)."
I have tried using "" and without "" around TO, as well as simply: if TO in [SFEANME]
I have not been able to find anyone trying to do something like this in Label Expression so maybe there is a better way, or I do not know how to syntax properly like the error message says.