I am extremely new at using attribute rules and Arcade for ArcGIS Pro, and I need some help on what I am sure is a simple process.
I have a column filled with text like this, "R4-52" and "H-R4-52" What I would like to do is use arcade to populate a new field where the output will be "R4", basically removing the dash and any characters before and after the dash. I know the replace function can be used to do this, but I wasn't able to find any examples.
Can someone help with this?
Solved! Go to Solution.
Are you looking for the exact value, 'R4'?
Then, check the following syntax
Let me know a few more examples if the substring value is dynamic.
Thanks for the reply!
The values are dynamic, my apologies.
I basically would like to remove the <text>"-" , "-'<text> and keep the middle characters.
Thanks for the help!
Another approach: split the string at the dashes into an array and then get the count of that array. If the count indicates 1 dash, grab the first element of the array; if the count indicates 2 dashes, grab the second element of the array. I'm pretty sure arcade arrays are 0 based.