You are using the wrong method its not LASTIndexOf its just IndexOf.