AnsweredAssumed Answered

Extract values to the left of a certain character in a string

Question asked by brianmcleer on May 9, 2018
Latest reply on May 9, 2018 by kimo

I received a table of data, and in that table is a field with latitude and longitude coordinates in one field. 

 

An example is: 45.4000/-122.700

 

I added two fields, latitude and longitude. 


Using field calculator I can successfully extract values after the '/' into the longitude field so that it is populated only with -122.700. 

 

The expression is:

!Latitude_Longitude![!Latitude_Longitude!.rindex('/')+1:]

I am not able to extract the values for latitude so that the latitude field will be populated just with 45.4000. I can also not perform this by using an exact number of characters, as the table of coordinates can have anywhere from 2 to 5 decimal places. Any help on how to extract all values to the left of the '/' would be appreciated. 

Outcomes