String str = "D:*Course 2007 Sem 2*WXET3309*WXET3309_Lab*WXET3309_Lab 2.doc";
System.out.println(str);
String[] word = str.split("\\*");
int i = word.length; //length is 1 more than array
i--; //last index = last string
System.out.println(word[i]);
The code above is code to get the last string separated by the symbol *. I wonder how should the code be modify if the string is changed to D:\Course 2007 Sem 2\WXET3309\WXET3309_Lab\WXET3309_Lab 2.doc or String str = "D:\\Course 2007 Sem 2\\WXET3309\\WXET3309_Lab\\WXET3309_Lab 2.doc";. Anyone would like to help me to solve this problem?