파일명에서 확장자 제외

1 개요[ | ]

How to get the filename without the extension
파일명에서 확장자 제외
파일명에서 확장자 제거

2 Bash[ | ]

MYFILE=hello.txt
basename $MYFILE .txt

3 Java[ | ]

public class MyClass {
    public static void main(String args[]) {
      String myfile = "hello.txt";
      System.out.println(myfile.replaceFirst("[.][^.]+$", ""));
    }
}

4 PHP[ | ]

$myfile = "hello.txt";
echo pathinfo($myfile)['filename'];

5 Python[ | ]

import os
print(os.path.splitext("hello.txt")[0])

6 같이 보기[ | ]

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