Java 파일명에서 확장자 제외

1 개요[ | ]

Java 파일명에서 확장자 제외
public class MyClass {
    public static void main(String args[]) {
        String myfile = "hello.txt";
        System.out.println(myfile.replaceFirst("[.][^.]+$", ""));
    }
}
public class MyClass {
    public static void main(String args[]) {
        String myfile = "hello.txt.gz";
        System.out.println(myfile.replaceFirst("[.][^.]+$", ""));
    }
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}