Field Calculator

90
2
10-26-2021 08:49 AM
Labels (1)
GarrettByrd
New Contributor

I'm having trouble field calculating everything left of the last space.

Ex. MAIN ST 

Ex. BARE HALLOW DR

I am need of just "MAIN" and Just "BARE HALLOW" for my street names field without the post type. I started with full address (425 S MAIN ST) and have most of them narrowed down by the script bellow. 

 

Ex: 4256 Monroe St 

I want to select everything right and left of space. 

 

s = 4256 Monroe St 

 

s.split(" ", 1)[1].rsplit(" ", 1)[0] 

 

Result: Monroe 

 

Ex: Monroe St 

I want everything before the space. 

 

s= Monroe St 

 

s.split(" ")[0] 

 

Result: Monroe  

0 Kudos
2 Replies
JoeBorgione
MVP Esteemed Contributor

See if this older post of mine can help.

can't wait to retire....
0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Try this

Parser: Python

Expression

!StreetName!.rsplit(' ',1)[0]

 



Think Location
0 Kudos