1 개요[ | ]
- Java 파일명에서 확장자 제외
Java
CPU
1.4s
MEM
71M
1.2s
Copy
public class MyClass {
public static void main(String args[]) {
String myfile = "hello.txt";
System.out.println(myfile.replaceFirst("[.][^.]+$", ""));
}
}
hello
Java
Copy
public class MyClass {
public static void main(String args[]) {
String myfile = "hello.txt.gz";
System.out.println(myfile.replaceFirst("[.][^.]+$", ""));
}
}
Loading
2 같이 보기[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- Java (3)
Java 튜토리얼 웹사이트 ― Thesmolt젠킨스 ― John Jeong젠킨스 ― Icesky