Finding the fourth index in text


#1

Hello

Similiar to .LastIndexOf, is there a way to find the fourth of something?

I’m reading PDF text to find the total amount of the invoice so I could get the amount that way, however the total amount is hidden among the other amounts when I write the PDF text, i.e. - £190 £190.00 £47.00 £316.00 £280.00 £47.00.

The total amount (in this case it’s £316.00) will sometimes change so I do need to find it. The only pattern I’ve found is that it’s always the fourth amount so I wanted to find the text that comes after the fourth £.

Is there a way to do that?

Thanks in advance for the help!


#2

@short, Why not give a try with Split ?

Solution : String variable.Split("£"c)(4).ToString.Trim answers what you want.
Note: The pattern should remain same.

Regards,
Dominic :slight_smile:


#3

Amazing, thank you!

I’m not really in the know with split, I need to look more into it

Thanks again!