I have these strings which are addresses of files and folder:
- ../../../folder1/sub1/sub12/
- ../../../folder1/
- ../../../another-folder/
I want to compare them using javascript – possibily jquery – to see if for example string 1 have a part egual to string 2 but something more saying that string 1 is child of string 2.
How can i do this?
In case your string can contain also absolute paths or paths containing
..not only at the beginning I would recommend checking if.indexOfreturn0instead of anything that is not-1.It can help with cases like.