I know many ways how to find a substring: from start index to end index, between characters etc., but I have a problem which I don't know how to solve:
I have a string like for example a path: folder1/folder2/folder3/new_folder/image.jpg
and the second path: folder1/folder2/folder3/folder4/image2.png
And from this paths I want to take only the last parts: image.jpg and image2.png. How can I take a substring if I don't know when it starts (I don't know the index, but I can suppose that it will be after last / character), if many times one character repeats (/) and the extensions are different (.jpg and .png and even other)?