Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TechModule;
- import java.util.Scanner;
- public class p07_RegexExtractFile {
- public static void main(String[] args) {
- Scanner scanner=new Scanner(System.in);
- String input = scanner.nextLine();
- String file=input.substring(input.lastIndexOf("\\")+1);
- String fileName=file.substring(0,file.indexOf('.'));
- String fileExtension=file.substring(file.lastIndexOf('.')+1);
- System.out.println(String.format("File name: %s%nFile extension: %s",fileName,fileExtension));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement