How can i find the extension of files in a specific folder in Android using subString() function in Java? or you can also suggest me the best way to do this.
Asked
Active
Viewed 77 times
-2
-
3Does this answer your question? [How do I get the file extension of a file in Java?](https://stackoverflow.com/questions/3571223/how-do-i-get-the-file-extension-of-a-file-in-java) – enzo May 09 '21 at 18:23
1 Answers
-1
String fileName = "document.old.pdf";
String extension = fileName.substring(fileName.lastIndexOf(".") + 1); // pdf

Daniel
- 1,426
- 1
- 11
- 24