Select to view content in your preferred language

Field Calculator

636
2
Jump to solution
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
1 Solution

Accepted Solutions
JoeBorgione
MVP Emeritus

See if this older post of mine can help.

That should just about do it....

View solution in original post

2 Replies
JoeBorgione
MVP Emeritus

See if this older post of mine can help.

That should just about do it....
JayantaPoddar
MVP Esteemed Contributor

Try this

Parser: Python

Expression

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

 



Think Location