Can get different position of index rather than first or last?



I am using “|” as delimitor. E.g. He|stole|my|apple|from|me
I want to get the word apple which is after the 3rd delimiter. Thus, anyway to get index of other occurrence (not only first or last)

Thank you xoxo



Hi, it works
variable.IndexOf("|", variable.IndexOf("|") +1)


What if in e.g.He|stole|my|apple|from|me
I want to get the delimitor position starting from behind (right instead of left)
I tried
variable.LastIndexOf("|", variable.LastIndexOf("|") +1)
variable.IndexOf("|", variable.IndexOf("|") +1)
variable.LastIndexOf("|", variable.LastndexOf("|") +1)
But none of it gives the delimitor position of the third last one.

variable.LastIndexOf("|", variable.LastndexOf("|") -1)
The above works but not accurate all the time, I am not sure why.


Didn’t get your use case.
You want index of apple, search index of apple. You need any specific word, do Split and then check.



variable.substring(a, variable.length)
Output supposed to be ‘apple|from|me’
But i dont get that


This expression will provide you index of last “|” for He|stole|my|apple|from|me
You need to do string manipulation i.e. change string and search for next “|”.