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

You don’t need split() for parsing paths! Just use methods from Java’s File class: :open_file_folder:
Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html

Along w/ some methods from class String: :abc:
Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html

final File f = sketchFile("img.bmp");
println(f);

final String folderpath = f.getParent();
println(folderpath);

final String file = f.getName();
println(file);

final int idx = file.indexOf('.');
final String filename = file.substring(0, idx);
println(filename);

final String ext = file.substring(idx);
println(ext);

exit();
1 Like