I have a string consisting of file separators; e.g. "Bancs\Bancs_CP_P&MB.xml".
I want to separate the string based on "\".
Here's what I'm trying:
public class Stringoperations {
public static void main(String[] args) {
try {
String fileSeparator = System.getProperty("file.separator");
String TestCaseName = "Bancs" + fileSeparator + "Bancs_CP_P&MB.xml";
String[] tukde = TestCaseName.split("\\");
System.out.println(tukde[0]);
System.out.println(tukde[1]);
} catch (Exception e) {
e.getMessage();
} finally {
System.out.println("here");
}
}
}
But this is not working.