I want to get one String from a String composed of many lines
Example String:
Date: May 12, 20003
ID: 54076
Content: Test
filename: Testing.fileextension
folder: Test Folder
endDate: May 13, 2003
The output I want is "Testing.filextension"
I tried a couple methods, but none return just the filename.
Method Attempt 1:
String[] files = example.substring(example.indexOf("filename: ")
for (String filename : files){
System.out.printlin(filename);
}
Method Attempt 2 was to try to split on a newline, but right now it just returns all the lines. My main issue is that the .split method takes (String, int), however, I don't have the int.
String[] files = example.split("\\r?\\n");
for (String filename : files){
System.out.println(filename)
}
String's.splitis overloaded? One takes just a string, the other takes a string and an int.filename:do you expect the result afterfilename:? Also, are there multiplefilename:in your input?