I have .txt files inside directory
I want to change the name of those .txt files, when saving.
I.e. /root/user/workspace/DataSet/dataset/file0.txt
I have already solved the problem in an inefficient way
for (int i = 0; i < img_n.length(); i++) {
char a = img_n.charAt(i);
if (a == '/') {
c++;
}
if (c >= 6) {
out += a;
}
}
return out;
I knew the 6 times '/' will come so when c>=6 add char to the new string.
So This is NOT how to remove all '/' in an input string If you see my code clearly
It is also not taking the chars between '/'.
Therefore the Question is: You don't know how many times '/' comes but, you also want to remove the characters between '/'.
How can I do this more generic and efficient way?