Remove filename extension in Java

后端 未结 10 2268
你的背包
你的背包 2020-12-09 08:48

(Without including any external libraries.)

What\'s the most efficient way to remove the extension of a filename in Java, without assuming anything of the f

10条回答
  •  醉话见心
    2020-12-09 09:21

    I know a regex to do it, but in Java do i have to write like 10 lines of code to do a simple regex substitution?

    With and without killing hidden files:

    ^(.*)\..*$
    ^(..*)\..*$
    

提交回复
热议问题