I am faced with the task of comparing two strings together.
- abc
\r\n
def- c
\n
de
My goal is to determine the index of string 2 within string 1.
Using the indexOf()
method is not an option due to different line endings, so I require an alternative solution that takes this into account.
It's important that I do not alter the original string as I need the substring index in reference to the original. Simply replacing all instances of \r\n
with \n
would disrupt the original indexes, necessitating a restoration process.