Select to view content in your preferred language

Remove characters following a certain word in ArcGIS Pro

1219
5
Jump to solution
10-27-2023 08:26 AM
wlsgudwls123
Emerging Contributor

Hi, I'm trying to delete characters following a certain word (<-this word is "LON") using the Calculate Field tool in ArcGIS Pro. Anyone has any ideas how to do this? I'm looking for a script that I can put in the "Comments = " block of the Calculate Field tool. 

I have a large dataset (n=389) and each line has different characters following the word "LON". So, the below script won't work. I'm looking for an alternative!

Replace($feature.<field_name>, "<text_value>", "")

 

0 Kudos
1 Solution

Accepted Solutions
RichardHowe
Frequent Contributor

Using python then:

!FieldNAME!.split("LON")[0] +"LON"

Just replace FieldNAME with the name of the field in question

View solution in original post

5 Replies
RichardHowe
Frequent Contributor

Using python then:

!FieldNAME!.split("LON")[0] +"LON"

Just replace FieldNAME with the name of the field in question

wlsgudwls123
Emerging Contributor

This worked! Thank you so much!!

RichardHowe
Frequent Contributor

No probs. Could you mark it as the solution so others can quickly find it?

0 Kudos
Brian_Wilson
Honored Contributor

Can you give some samples of the data to better show the problem?

Sounds like you have something like

"LON 123" and you want to replace the "123" part?

 

0 Kudos
Faiez
by
Frequent Contributor

Hi!

You can replace or delete any words or part of the word by any of the following options:

1.

2.

0 Kudos