We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello guys,
I'm trying to load some images using the selectFolder function, the problem is that it looks like in Processing it needs to be with the normal bar, rather than the inverted one.
For example, the folder I chose looks like this: C:\Images and it would look like this: C:/Images
I tried to use the replaceAll function to override in the String, but it is not working.
Below is the example.
private String pathImg;
void setup() {
selectFolder("Select a folder to process:", "folderSelected");
}
void folderSelected(File selection) {
if (selection == null) {
println("Window was closed or the user hit cancel.");
} else {
pathImg = selection.getAbsolutePath();
//String newPath = pathImg.replaceAll("\", "/");
//pathImg = newPath;
println("Path: " + pathImg);
}
}
Thanks for listening
Answers
say \ for \ in strings
similar for \t \n \n
Hello Chrisir, thanks for the feedback...
Sorry i did not understand how to do...
Thank you
I tried it like this but gave the error:
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ...
Thank you
OK, now, it worked ...
It would have to replace, instead of replaceAll
Thanks so much!
Happy Easter!
Hi, sorry, I did not see the message before ... thanks!