hope this expression would help you resolve this str_latitude = IF(str_input.Contains(“/”),Split(str_input,“/”)(1).ToString,Split(str_input," ")(1).ToString) str_longitude = IF(str_input.Contains(“/”),Split(str_input,“/”)(0).ToString,Split(str_input," ")(0).ToString)
You are checking the co-ordinates with “/”, but in some cases latitudes and longitudes may differ with space.
Please check it and provide me a solution.
yah this expression does the same
it will look for / in the string input, if its not there then it would split them with space
kindly try this and let know for any queries or clarification
@Palaniyappan,
Please use the below string to get the co-ordinates from it.
Example 1:- This is a text containing coordinates of 15.78 phase. Please check the co-ordinates -89.74589501 145.52147876.
Example 2:- This is a text containing coordinates of 15.78 phase. Please check the co-ordinates -89.74589501/145.52147876.
@vishal.kp
The above code works fine.
It is not giving the correct output for some cases which are listed below.
Case-1: When the Latitude and Longitude are separated by comma
Case-2: When the Latitude and Longitude are enclosed by parenthesis (-89.74589501, 145.52147876).
Case-3: When the Latitude and Longitude are enclosed by Double quotes
“-89.74589501, 145.52147876”.
Could you please check these cases and sorry for the trouble.
first use a assign activity like this str_input = str_input.Replace(“,”," “).Replace(”“”“,”")
then another one with this expression str_latitude = IF(str_input.Contains(“/”),Split(str_input,“/”)(1).ToString,Split(str_input," ")(1).ToString) str_longitude = IF(str_input.Contains(“/”),Split(str_input,“/”)(0).ToString,Split(str_input," ")(0).ToString)
@vishal.kp
The above code is failing when the co-ordinates is enclosed in double quotes
case1: “-89.74589501 145.52147876”
case2: -89.74589501 /145.52147876
I had searched in forum that we can extract decimal values from the string by this code “(-?[0-9]+(?:[,.][0-9]+)?)” but it is failed to get the data in case2.
Could you please check this scenario.