I am comparing file names in a folder ,I want to remove some part of string and check whether name exists or not
Here is my file name :
file1Name:AB-05012_MM-AB_585859_01
file2Name:AB-05012_MM-AB_732320_01-1
Now i want to compare the string only till
AB-05012_MM-AB_732320_01 ignore '-1'
Here is my logic
if (file1Name.equals(file2Name.contains(""))){
list.add(file1Name);
}
-1? Or-and a digit? Or-and any character? Or-and more than one character? What characters do you want to check for following the-? Or do you want to look for-followed by a digit in the middle of the name? Can anything follow the-1? If so, what?