Can I use part of Processing source code in my code?

Well, I guess I should use the getName() method for the name, but indexOf returns the position of the first occurence, and not the last one that I need.
What if the user feeds in a picture called thing.stuff.thing.image.whatever.jpg? Then it will be renamed to thing.bmp, which would be less acceptable.

Hmm, maybe I could just reverse the filename, then do indexOf, then replace the extension with “pmb.”, and then reverse it back and add to the end of getParent?

In the end, I don’t think it really matters, as the performance impact of using split and join once per run would be as negligible as the performance impact of reversing the string, indexOf, and reversing it back - and the first method seems to be more readable, at least for me!

So I’ll just replace the first split to get filename with getName, and keep the second split.

Thanks for the extended info though!