Get the line number of a string using index or position