Skip to main content
Solved

Substring without last character

  • August 13, 2019
  • 3 replies
  • 13 views

Hi,

 

I have a Condition Statement within AttributeManager that splits coordinate values. The value for seconds (_lat{2} and _long{2}) have different length e.g. 23° 05' 30.95420" N or 23° 06' 47.954" N

 

 

When I use the above it always returns the value but with E or N.

 

Any thoughts on how can I get only coordinates seconds?

 

 

Regards

Best answer by danullen

Try this:

 

@Substring(@Value(LATITUDE),4,(@FindString(@Value(LATITUDE),N)-4))

 

 

@FindString gives you the position of the "N". From that number you want to subtract your starting point, i.e. "4", to get the length of the seconds part of your string.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

heidelbergh
Forum|alt.badge.img
  • 4 replies
  • August 13, 2019

Hi ms_1990,

 

The @FindString function returns the position of the 1st occurence of the Search String. For example: position 15, while the @Substring function expects the length of the substring. So you will have to calculate this length will a simple substraction of the total length of your LATITUDE attribute minus the position returned by @Findstring Function. Let me know if it works.


Forum|alt.badge.img
  • 104 replies
  • Best Answer
  • August 13, 2019

Try this:

 

@Substring(@Value(LATITUDE),4,(@FindString(@Value(LATITUDE),N)-4))

 

 

@FindString gives you the position of the "N". From that number you want to subtract your starting point, i.e. "4", to get the length of the seconds part of your string.

  • Author
  • 1 reply
  • August 14, 2019

Try this:

 

@Substring(@Value(LATITUDE),4,(@FindString(@Value(LATITUDE),N)-4))

 

 

@FindString gives you the position of the "N". From that number you want to subtract your starting point, i.e. "4", to get the length of the seconds part of your string.

Thanks, it works!