Skip to main content
Solved

Substring without last character


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.
View original
Did this help you find an answer to your question?

3 replies

heidelbergh
Forum|alt.badge.img

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
  • 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
  • August 14, 2019
danullen wrote:

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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings