added get substring index of nth occurence