I have a python script to remove the text in parentheses for labeling, and I cannot figure out how to convert it to work with Arcade. (I did not write this script, but I am trying to get the same results in AGOL.
The Python script is: def FindLabel ( [label] :(
i = S.find('(')
if i == -1:
elif i > 0:
I know that Arcade does not have a strip function, so I was trying trim, and instead of the newline function, I was just typing a space.
Example: '82 (Globe)' needs to be '82'
Thank you in advance.
Solved! Go to Solution.
A small addition to the solution provided by Ken: if you are interested in returning a numeric value, you might want to explicitely convert it to a number. Also the text you return would have a space at the end, since split on "(" will result in an array with two elements: "82 " and "Globe)". To avoid this you could include the Trim and Number functions, like this:
var array = Split($feature.field, "(");