changes made in indexof function.works fine for string too.