What is LastIndexOf method and how it works?

Hello There,

Can someone please explain with a simple example of the “LastIndexOf” method? I somehow can’t see to understand this one …

Thanks in Advance

Hi @Hara_Gopal,

I assume this for string method:

" LastIndexOf () method is used to find index position of the last occurrence of a specified character or string within String.".

Please refer the below post:

Sasikumar K

if the input string is “You searched for author Mark Twain. His books can be found in the following stores: Bookland,Classics bookstore.” and you want to get only the author i.e.“Mark Twain”,

You would be using one the expressions like,

First part is,it splits by period symbol(.) then it takes only the FIRST part,then it find the substring in that part from the last till reached the word “author” as we mentioned there as a parameter.

1 Like